Skip navigation
Currently Being Moderated

How to use "flashFile1" in "flashFile2"?

Apr 29, 2012 12:42 PM

Tags: #adobe #files #one #in #multiple #flash_cs5.5



I'm new here and need some help. I've been searching the net to find anything about what the title says.


What I wanna do is:


#1. Have a Flash document with content.


#2. Have another Flash document which is a button(animated).


#3. Use the second document's button in the first document without having the all the content of the second document in the first documen't library.


#4. If I change anything in the button document it should atomaticlly update in the first document (file refresh maybe needed?).




I hope you understand what I mean. Please ask if something is unclear.





// wirrew

  • Currently Being Moderated
    Apr 29, 2012 3:43 PM   in reply to _wirrew

    You can load the second file into the first file dynamically so there is no need to do anything to the first file.  Any time you need to change the second file, just publish a new second swf and replace the current one with it wherever you store it. 


    If you are using AS3 for coding, then you can use the Loader class to load the second file into the first.  In the first file you would use something like...


    var loader:Loader = new Loader();


    loader.load(new URLRequest("secondFileName.swf"));

    Mark as:
  • Currently Being Moderated
    Apr 30, 2012 2:16 PM   in reply to _wirrew

    When you import an swf into a library it loses all of its code.  That is why I am telling you to dynamically load the file.  If you import the file into the other file's libarary there is no way to have it update when you make changes to the orginal.


    The second file you want to load could be in the same folder as the one loading it.  So you would just need to have the two files in the same folder (along with the eventual html page to avoid another issue).  If you are getting an error you should show the code you tried.

    Mark as:
  • Currently Being Moderated
    Apr 30, 2012 4:31 PM   in reply to _wirrew

    The file will be loaded when you run the main file.  To control its position you can assign x and y properties to the loader, as in...


    loader.x = 20;

    loader.y = 30;


    Another way to position it would be to add it to a movieclip that you situate in the main file.  If you were to give that movieclip an instance name on teh stage, like "holder" for instance, then instead of using addChild(loader), you could use




    As far as the security issue goes, I cannot see why that is happening if you are working in Flash and are running the main file.  One thing I should have you check just to be sure is that you are working with AS3.  Check your Flash Publish Settinsg and make sure they are set for AS3.

    Mark as:
  • Currently Being Moderated
    May 1, 2012 4:33 AM   in reply to _wirrew

    YOu need to resolve the security error before anything will work properly.  To resolve it I suggest you search Google using "AS3 Error #2000: No active security context" and try anything you can find that id offered as a solution.

    Mark as:
  • Currently Being Moderated
    May 1, 2012 6:41 AM   in reply to _wirrew

    Sound good , And I fond  one website called  cheap shoes online . does the website use the flash on the homepage .

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points