A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Using a library item in a separate fla

  1. #1
    Junior Member
    Join Date
    Jun 2008
    Posts
    9

    Using a library item in a separate fla

    I have the files main.fla, stuff.fla and Script.as in the same folder. Can I get the movieclip myButton from stuff.fla's library to main.swf at compile time? Like if I put

    var btn:MovieClip = new myButton();
    stage.addChild(btn);

    to Script.as and myButton is in main.fla's library it works, but if it's in stuff.fla the code doesn't find it.



    I use CS5.

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    have a look here, easier than trying to explain, I think http://stackoverflow.com/questions/7...n-external-swf

  3. #3
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    You can try load up the fla bytearray and turn it into an swf in flash by doing bytes.compress(CompressionAlgorithm.LZMA) i believe thats the way to build it

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    I think you might want to start with using new ApplicationDomain(), instead of trying to get to grips with http://help.adobe.com/en_US/as3/dev/...de46-7d54.html stuff.

    it basically just loads an outer swf to allow you to use its library, but you load the library item as a class, you just need to give the library items a class name.

  5. #5
    Junior Member
    Join Date
    Jun 2008
    Posts
    9
    Thanks for your responses.

    Will these work regardless of where the main.swf is located? I tried some beginner tutorials on some of those, and when I moved the swf it still searched for the path during runtime (and couldn't find anything).

    The only reason I'd need this is because having 2000 frames worth of images in the library slows down working on the main file. I can copypaste them from a different file as late as possible, but I was wondering if there was a smarter way to do this.

  6. #6
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Here is a quick example on using an external library using ApplicationDomain()

    You could always think about using xml to load your images with URLRequest() from a separate folder, using a Loader() to show the loading instead of just waiting.

    plenty of tutorials on loading images with xml in as3 on the net.

    http://www.republicofcode.com/tutori.../as3slideshow/

    that should at least get you started
    Attached Files Attached Files

  7. #7
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    at compile time
    she says different FLA, not different SWF. what she needs to do is to export SWC and put that in script optoins. very good workflow with heavy assets, btw.

    https://www.youtube.com/watch?v=h94WmftF8vM (yuo only need first part) and then https://www.youtube.com/watch?v=lGsgZPRa4fk for 2nd FLA
    who is this? a word of friendly advice: FFS stop using AS2

  8. #8
    Junior Member
    Join Date
    Jun 2008
    Posts
    9
    Thanks, SWC file was just what I was looking for (it works now), and thanks to everyone for responding.

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