A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: aligning swf on movie load

  1. #1
    i can load a swf file using "load movie" action script. but how can i change where the swf movie appears in the main movie? ex. i want the movie to appear 100 pixels left and 100 pixels below the default appearance. how is this done? it probably has to do with the myMovieClip._xscale, but what would the actual action script look like?

    thanks for all the help.

  2. #2
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    The way you position such a movie is to create a Movieclip and Target it for Load Movie.

    In KoolMoves there is an Auto Feature for this called Import SWF. Its a built in tool. All you have to do push the Import SWF button off of the toolbar and a MovieClip with whatever SWF is loaded into it. In KoolMoves the Movie is shown as a Bounding Box.

    If you really want to play with the X an Y of a level it is possible.

    Load your Movie into a Level using load movie and then instead of using refrencing a Movieclip you reference the Level...

    To refrence a Level you the syntax is _levelN

    so if your level is loaded in level 1 you wopuld regerence it as _level1

    Okay now that you know how to target a level you will adjust the X and Y properties of the Object...
    In order to do this you type the Movieclip name or Level Name followed by a dot and then _x for the X value in Fips or _y for the Y value in Fips.

    So in other words if you want Level 1 to be positioned 50 fips from the left hand corner and 50 fips from the top edge you would use this syntax:

    _level1._x=50;
    _level1._y=50;

    If you are wondering what a Fip is... Well Flash is a scalable and relative design medium. There are no Absolute values when mesauring distance. A fip is an equal unit. When it scales the Unit Scales with the movie.



  3. #3
    i have a button set to load the swf on release. i don't want the swf to appear until the button is released. so i can't import a clip in, because it will play automatically right? as far as action scripting is concerned, that seems to be the way to go, but i still haven't gotten the syntax down where it even moves the swf.
    i have tried on(release) {_nameofswf._x=50} and a few variatons, but can't get anything to work. could you write out the complete line of code please.

    thanks

  4. #4
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    Originally posted by kovar
    i have a button set to load the swf on release. i don't want the swf to appear until the button is released. so i can't import a clip in, because it will play automatically right? as far as action scripting is concerned, that seems to be the way to go, but i still haven't gotten the syntax down where it even moves the swf.
    i have tried on(release) {_nameofswf._x=50} and a few variatons, but can't get anything to work. could you write out the complete line of code please.

    thanks
    What you are attempting to do will not work that way becuase you have to first load the Movie into a Clip or into a Level. When you target it the syntax for adresing a level is _levelN

    This is referenced here: http://www.macromedia.com/support/fl...ts/level.html#

    and loadMovie is referenced here: http://www.macromedia.com/support/fl...loadmovie.html

    Okay this is what you will do...

    1. Create a button and use the Built in Load Movie Function, for simplicity sake- Note the Level that you are loading the Movie to. For the purposes of this example we will load into Level 1. If you really feel like skiping this part the Syntax to load a movie is loadMovie(url,location)

    2. Now add a second Action to the Button. This time add an Actionscript. The script will look like this:

    on(release){
    _level1._x=50;
    _level1._y=50;
    }

    Again if you want it all scripted it will look like this:

    on(release){
    loadMovie("mymovieurl.swf",_level1);
    _level1._x=50;
    _level1._y=50;
    }


    That is all there is to it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center