English Deutsch 中文   



Center Obj SWF within larger Flash Container

Using Pano2VR/Object2VR SWF files with your own Flash projects

Center Obj SWF within larger Flash Container

Postby Plastic3D » Fri Jul 23, 2010 3:21 am

Here is my first post here, in a little deadline panic.

Having a lot of trouble centering a 200x200 .swf within a 400x400 .fla file. It renders just fine using the script from the api page, but it always snaps to upper left corner, no matter what settings I use for "setWindowPos"

Using CS5, AS3 script from API posted on the Garden Gnome wiki.

Code: Select all
function initObj(e:Event) {
// check if the panorama object is available and initialize it
   if ((vr!=null) && (vr.obj!=null)) {
      removeEventListener( Event.ENTER_FRAME , initObj);
      vr.obj.setWindowSize(400,400); // resize the window
      vr.obj.setWindowPos(200,200); // reposition


I have tried to use alternate positioning code from the AS2 script, but
Code: Select all
// Set the dimensions and position of the pano
  vr.window_width=500;
  vr.window_height=380;
  vr.window_x=100;
  vr.window_y=10;
};


...does not work with AS3 apparently. What to do?!!?

I *have* successfully made the SWF to center within Flash within AS2, however the motion of the object SWF is chunky, resets oddly at random times, and the movie will only orbit when the mouse cursor is within the movie (forcing the user to click-pan-click-pan to rotate the model - not an ideal situation).

With AS3, the mouse can exit the frame and still orbit the movie, which is very nice.

Does anyone have any ideas? Are there tricks using skins? I tried to make a 400x400 skin, but that didn't seem to make a difference when bringing the swf into Flash CS5.

Also I'm having problems doing this in CS3. I have also tried to put the object SWF within a folder in Flash, and tried to move that new folder around, using align tool, center tool for example.

Thanks for any help!!
Plastic3D
 
Posts: 2
Joined: Fri Jul 23, 2010 2:35 am

Re: Center Obj SWF within larger Flash Container

Postby Plastic3D » Sun Jul 25, 2010 6:30 am

I figured it out: it's all about making a movie clip symbol, applying the code to that symbol, and then dragging it onto a layer your stage. The symbol can be moved around that way.

Apparently in my case with AS3 code, the "vr.pano.SetWindowPos " code doesn't affect the location at all.
Plastic3D
 
Posts: 2
Joined: Fri Jul 23, 2010 2:35 am


Return to ActionScript

Who is online

Users browsing this forum: No registered users and 1 guest