Hi to all,
Is it possible to insert 1 flash file into another?
Basically i m having the flash file which contains only actionscripts.
No items in liabrary.no items on stage.
Nothing.this file I want to inert that action scripts in my another flash file.
Is it possible?
will the objects will be created?
This is possible, at least in the sense of being able to embed one SWF inside of another.
Here is the code you will use to load it into a movieClip named swfHolderMC
Code:
loadMovie("external.swf", "_level0.swfHolderMC");
__________________
jeremy - gnomeontherun Educated questions often get educated answers, and simple questions often get simple answers.
Realise this is a little old, and I'm assuming you figured it out, but...
I used the following actionscript to load a flash form into another flash document...
Code:
stop();
///this creates an mc to hold your swf
this.createEmptyMovieClip("loady",5);
loady._x = -60;///whatever x coordinate you want
loady._y = -205;///whatever y coordinate you want
//event that calls your load function
loady.onEnterFrame = loadIt;
///function that loads into the mc you created
function loadIt()
{
loady.loadMovie('entry.swf');
}
I found that elsewhere, while searching for answers to the same problem as you.
HOWEVER... it has presented me with another problem, that I don't know how to fix, so... any help would be appreciated...
If you look at a preview of what I'm trying to do at http://www.rockandindie.com/ayrplay/index.htm and click on the 'Enter' link in the main flash element, you'll see the page on which I've loaded one flash document into another.
The problem is tho... once you've viewed that page, it then loads on every other page, too.
So, how do I change the code so that it only loads when viewing that page???
You need to hide the movieClip somehow, because its dynamically created by Actionscript.
So when other links are pressed they should do something like this idea,
1. Check if the new movieClip is there
2. If No, display page
3. If yes, then move the clip off the stage
There are other ways, such as removing the clip completely, but that seems like it would cause more loading for people who look around more. This code is untested, but its the idea.
Code:
if (loady) {
_root.loady._x = 1000;
_root.loady._y = 1000;
}
__________________
jeremy - gnomeontherun Educated questions often get educated answers, and simple questions often get simple answers.
Last edited by gnomeontherun; 11-27-2008 at 01:22 PM..
Mind you... I haven't really a clue what I'm doing.
I've built that site purely by reverse engineering a template I found, and googling for code snippets to achieve what I was wanting to do with it.
Thus, I just copied and pasted the code you gave me above. If I was supposed to add anything to it... I didn't.
I am learning stuff as I go, but for the most part... actionscipt is still only marginally more coherent to me than hieroglyphics.
Looking through the pre-set code options (it's Flash CS3 with AS3), I see there's a 'removeMovieClip' instruction in the Global Functions-Movie Clip Control menu... is that a way to do it?
Alternatively, I have that entire loader on a layer of it's own... is it possible to make the layer only visible on the time-line where the page sits that I want it to appear on?
I started this project on the office PC, using Flash 8 pro.. actionscript 2, and have now moved the project onto my laptop... Flash CS3, with actionscript 3.
So... possible conflicts with doing that? I keep saving the file as a Flash 8 file.
Anyway, I've put the .fla in a .zip file and uploaded it to my webspace at:
It was too big to just attach to this post. I don't know if the .fla file contains the entire library associated with the file, if it does, then that'll explain the size of the file. With all the trial ad error I've been doing, I no longer know what is vital and surplus in the libray!
So, it's at that link if you want to have a look at it.
There aren't conflicts if you set up to export your project as AS2, not AS3. This is done via the Publish Settings. The library contains anything you import, so that can make it very large. One of the concepts of advanced Flash is to reduce the size of the library by loading from external sources, just FYI.
Your link doesn't work though...ideas?
__________________
jeremy - gnomeontherun Educated questions often get educated answers, and simple questions often get simple answers.
Ok found issues, mostly with the placement of the code. First, go to the Actions panel.
You need to find the moveClip named Main Contents - and delete any code on the Layers under that clip. Then you have to scroll up and see your multiple buttons called flashmo 009. The third one is for the Enter button and put this code there. You may need to change the x and y, depending on where you want it.
Code:
on (release) {
change_page("p3");
if (_root.loady) {
_root.loady._x = 400;///whatever x coordinate you want
_root.loady._y = 150;///whatever y coordinate you want
///this creates an mc to hold your swf
}
else {
this.createEmptyMovieClip("loady",5);
_root.loady._x = 400;///whatever x coordinate you want
_root.loady._y = 150;///whatever y coordinate you want
//event that calls your load function
_root.loady.loadMovie('entry.swf');
///function that loads into the mc you created
}
}
On the rest of the buttons put this code (of course change the change_page() for the appropriate page. Again you might need to change the x and y, to hide it enough.
Code:
on (release) {
change_page("p1");
if (_root.loady) {
_root.loady._x = 1000;
_root.loady._y = 1000;
}
}
You were putting the code onto a group of buttons, which means that every click the code was reloading and placing the entry.swf in the same place everytime. This way now it only displays it when the button for Enter is pressed, otherwise it checks if the loady movieClip is loaded and moves it.
__________________
jeremy - gnomeontherun Educated questions often get educated answers, and simple questions often get simple answers.
In the library, I can only see one 'button' labelled flashmo009 and the 3 flashmo 009 movie clips for the graphical display of the buttons.
I guess this is where me lack of discipline in making sure I labelled everything in the library and kept it tidy by discarding everything I didn't need... is coming back to bite me.
So... sorry for inducing an 'idiot proof' solution, but... how am not seeing what you obviously are???