A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: loading MovieClips

  1. #1
    Junior Member
    Join Date
    Nov 2005
    Posts
    19

    loading MovieClips

    I'm new to AS3 and have been stumped by a pretty simple concept.
    I have a main.as file which will need to import other, outside MovieClips dynamically when a certain button is pressed.

    Heres the example: Three buttons have appeared "Ipod", "Mobile" and "TV". When the button for Ipod is pressed then an Ipod MovieClip appears and is then unloaded once the "TV" button or "Mobile" is selected.

    What there needs to be is a directory of corresponding classes to the objects that the buttons can call upon. So the main.as would dynamically load the objects by calling something like: "com.technology.[button title]" or in other words "com.technology.Ipod.as".

    Can anyone help? I'm pulling my hair out! If this is badly explained or something isn't clear, please let me know.
    Thanks,
    BeechyBoy

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    The MovieClips are always part of the movie and stored in the library. In AS3 when you check the export for actionscript box flash will automatically create a class if it does not find any. Otherwise you create your own class and enter the path where it says class.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Junior Member
    Join Date
    Nov 2005
    Posts
    19
    Thanks cancerinform,
    The way I need it to happen is so that main.as and it's main.fla file should always stay the same and act as a stage for all 'Objects' in the "com.technology.objects." directory to get loaded into.
    So even if by inserting one of the titles of the 'Objects' contained in the "com.technology.objects." directory dynamically, then that particular 'Objects' MovieClip attributes will get loaded and displayed.
    Does this make sense, and does this mean I will need to have fla's for each 'Object' MovieClip's visual elements?

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Make main a Document class. This will be then the object to which all movieclips are added.
    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    Junior Member
    Join Date
    Nov 2005
    Posts
    19
    Will the main Document class's library need to have all the visual elements inside? In a more objected approach, can I have these visual elements in external classes?

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    You can write your own classes for the movieclips, but you need to set the classpath for each movieclip in the library. The Document class is just the base class for your movie. You add the objects from the library by AS. Example:

    var mc:MyClip=new MyClip();
    addChild(mc);
    - The right of the People to create Flash movies shall not be infringed. -

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