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.
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();
Thanks for the answer, but I've just started with Flash.
Now if I've written this code U gave me, where will I find the actual button/file? I just get a security error message about someting.
I would just like to draw the "flashFile2" 's .swf file in to the library of "flashFile1" and use it like that. But if I do this, the file just imports like a static image and not looking like the actual button file.
Hope you can still help
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.
Ok, I got the two files in the same folder and this is the code I'm using.
var loader:Loader = new Loader();
And this is the error message I'm getting: SecurityError: Error #2000: No active security context.
And I still don't know how this other file will be implemented in the first file? Will it just pop up in the library, or will it just pop up on screen when I run the application? How will I be able to set it's position?
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.
Oh, I should have mentioned this earlier but I forgot to. Yes, I'm working in ActionScript 3.
So, if I've understood you right, I will NOT be able to see the file on the stage until I run the file?
Still, the error message is still showing up, and no file is loaded/showing up when I run it.
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.
Europe, Middle East and Africa