A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: how to load a symbol using actionscript?

  1. #1
    Registered User greenham's Avatar
    Join Date
    Mar 2005
    Location
    Australia
    Posts
    555

    how to load a symbol using actionscript?

    How do you load a symbol using action script, including setting its _x and _y properties and on which layer?

  2. #2
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    If your loading on a layer, you use an empty movie clip with an instance name. You don't have to set the x and y, cause the dot of the empty clip is where the top left corner will sit when it loads.

    on(release){
    _root.mtClip.loadMovie("movie1.swf");
    }

  3. #3
    Registered User greenham's Avatar
    Join Date
    Mar 2005
    Location
    Australia
    Posts
    555
    thanks iaskwhy, once again you have been the one with the answers I need Can you load an external flash movie into a movie clip?

  4. #4
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    That's what my code above was for. What were you originally asking, how to load a movie clip from the library?

  5. #5
    Registered User greenham's Avatar
    Join Date
    Mar 2005
    Location
    Australia
    Posts
    555
    yes, I wanted to load a symbol from the library, is this possible when the final swf files does not havea library?

    [edit] this is great and all, it works... but the buttons in my external file when loaded into my 'container' swf dont work... why?
    Last edited by greenham; 04-17-2005 at 03:02 AM.

  6. #6
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Of course it has a library. You use attachMovie code to call something from the library to the stage. You can load that movie into another one, and that still works.

    If you used loadMovie like I described above, and the buttons don't work, then the target path name may have changed. Are you using frame button code, or code on the button, but calling something using Absolute targetting? Show the button code.

    I'll attach a fla showing how to use attachMovie. To do a simple test, load the swf from that attached movie into another movie and test it. That shows the swf still has it's library items. At least the ones used in the movie, and the ones with Linkage identifiers.
    Attached Files Attached Files

  7. #7
    Registered User greenham's Avatar
    Join Date
    Mar 2005
    Location
    Australia
    Posts
    555
    ok, now I cant seem to get it to load in my swf! today is not my day. After near on a hundred reads, I understand what you are saying by the target path changing although I dont think it can in this case, the following code is on my button.

    Code:
    on (release) {
    	colorblob = new Color(_root.colorblob); 	colorblob.setRGB( 0xFF0000) 
    }

  8. #8
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    To load the colorblob movie into the main movie, make an empty movie clip. Just a new movie clip with nothing in it. Go back to the main stage. Look in the library for the empty clip. Make a new layer and drag out an empty clip to the stage. Give it the instance name of mtClip.

    Now code a button or frame in the main movie with the line;

    _root.mtClip.loadMovie("colorblob.swf");

    The button in colorblob now needs to change;

    on (release) {
    _root.mtClip.colorblob = new Color(_root.colorblob);
    _root.mtClip.colorblob.setRGB( 0xFF0000);
    }

    The "loaded" movie takes on the instance name of the clip you load it into.

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