Preload main swf with another swf
Hey everyone,
I have two swf files, one is a preloader and the second is
the main file. I want to preload the main file using my preload
swf. It works, however the main swf starts to play after about 11%
of it is preloaded, how can i stop this? I want to preload the
entire main swf and then have it play. Here is the code i'm using
in my preloader swf. Or if anyone can tell me another way, anything
that will work at this point! I'm fairly new to this so any help is
much appreciated. I need this asap so anyone that could help,
please do! Thanks in advance!!
insert a blank frame before your current 1st frame in your
main swf and attach a stop() to that frame.
in your preloader use:
Similar Messages
-
Unable to load external swf which has runtime sharing with another swf.
Hi,
I am getting issues on loading external swf say "importer.swf" file into another swf file say "loader.swf" for second time like
ReferenceError: Error #1065: Variable testSymbol is not defined. VerifyError: Error #1014: Class testClass could not be found.
at global$init()
In the external swf "importer.swf", i am trying to import the symbol "testSymbol" from another swf file say "exporter.swf", which exports through runtime sharing option for the symbols.
I am having some buttons in loader.swf file and on each button click i am loading different swf files into the loader.swf after unloading the previous one.
I am able to load and unload different swf files but unable to load the importer.swf file which is sharing symbols from external swf and that too for the second time i.e., when i click the button twice.
When trying to debug with flash debugger, all the other swf files are being unloaded before loading of another swf but the swf which is sharing symbols/classes with another swf is not getting unloaded.
Output when i am trying to load two files example and importer files into loader.swf file on two different button clicks. On first button click example.swf is loaded. On second button click , example.swf is unloaded and importer.swf is loaded which is successful. On first button click again importer.swf is unloaded and example.swf is loaded. On second button click again, example.swf is unloaded and importer.swf is loaded, here i am getting issues shown above.
Attemping to launch and connect to Player using URL D:\runtime issue\loader.swf
[SWF] D:\runtime issue\ loader.swf - 8181 bytes after decompression
[SWF] D:\runtime issue\example.swf - 441708 bytes after decompression
[UnloadSWF] D:\runtime issue\example.swf
[SWF] D:\runtime issue\importer.swf - 1920 bytes after decompression
[SWF] D:\runtime issue\importer.swf - 441708 bytes after decompression
[SWF] D:\runtime issue\ example.swf - 441708 bytes after decompression
[UnloadSWF] D:\runtime issue\ example.swf
[SWF] D:\runtime issue\importer.swf - 1920 bytes after decompression
ReferenceError: Error #1065: Variable xxxxxx is not defined.
Debug session terminated.
Code i am using
b1.addEventListener(MouseEvent.CLICK, b1Clicked);
b2.addEventListener(MouseEvent.CLICK, b2Clicked);
var ldr:Loader;
function b2Clicked(e:MouseEvent)
if(ldr != null)
ldr.unloadAndStop(true);
ldr = new Loader();
ldr.load(new URLRequest("importer.swf"));
addChild(ldr);
function b1Clicked(e:MouseEvent)
if(ldr != null)
ldr.unloadAndStop(true);
ldr = new Loader();
ldr.load(new URLRequest("example.swf"));
addChild(ldr);
If i try to open the swf using IE, i am not getting any issues at all. But i need to open this loader.swf in a air application. Also when i use loaderContext for the loader instance i am able to get rid of this issue but i cant use it in my application.
So, please help me in resolving this issue.
ThanksI got my answer. I had to append the photo url to the 'movie' value of the javascript embed method. Like this:
<script language="JavaScript" type="text/javascript">
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
'width', '550',
'height', '400',
'src', 'lesson2',
'quality', 'high',
'pluginspage', 'http://www.adobe.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'lesson2',
'bgcolor', '#ffffff',
'name', 'lesson2',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','always',
'movie', 'lesson2?photo=http://www.flash-mx.com/images/image1.jpg',
'salign', ''
); //end AC code
</script>
Thanks,
srb. -
Controling a loaded swf with another loaded swf
I have a blank stage with only AS that loads an swf
addChildAt(0) and a second one addChildAt(1). This works. When the
user interacts with (1) it calls another addChild (not indexed) and
possibly that one loads another, depending on the choices made by
the user. How can I get any of these to control that very first
child that was loaded at (0)? I have run out of ideas.
Some of the code:
(on the main swf, nothing on the stage, only code that loads
the next two)
addChildAt(pHolder, 0);
pLoader.load(pURLReq);
pLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
pLoaded);
and for the second:
addChildAt(mHolder, 1);
mLoader.load(mURLReq);
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
mLoaded);
On the child of childAt(1), I have:
function replaceSWF(e:MouseEvent):void
pLoader = new Loader();
pLoader.load(new URLRequest("p.swf"));
pLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
placeNewClip);
function placeNewClip(e:Event):void
removeChildAt(0);
addChildAt(e.target.content, 0);
If I use this exact same code from that very first swf, the
one that loads the first two external swfs, it works, but once I
put it on one of hte other loadeds and sub loaded swfs, I can't get
it to work. In the current state (0) it just makes everything on
the stage disappear, so I figured then using the index of (1) would
do it, but that or any other number results in absoluly nothing.
Help! I am really out of ideas here.
(the stacking looks like this) ---
sub second loaded SWF <==== needs to tell first loaded SWF
to unload then load a new swf at same index
second loaded SWF <==== loads the next one above
first loaded SWF <=== needs to be removed and another swf
loaded at the same index
mainSWF (loads two others) <=== code placed here works for
first loaded SWFKglad,
I tried your code and ran into some problems with stopping
the mc's, as the embedded mc's within the loaded swf need to stop
as well. I found the attached code to stop the mc's, but now am
having trouble with the sound objects.
Here's the issue, I used this:
this.soundPosition = currentMovie.loop1.position/1000;
this.currentMovie.loop1.stop();
... for the sound object stop commands and listed a new one
for each loop I was using. On the play button I started them back
up again. This all works, but when I start them up again they all
play, not just the one that is currently paused. Do you mind giving
me some guidance with the for (obj in mc) loop? My loop experience
is nil. What I want to do is have the code cycle through all of the
loops to see which one is playing, then store that information in a
variable, then pause and play the variable. Does that sound right?
Thanks again for the help!
-Sandy -
Error when opening swf from another swf
Hi all,
I'll try to explain this as good as possible.... I made a maze game that works perfectly when I run it by clicking on it's own .swf file, but when I try to access it from another .swf file which is a menu for the games I created, it does not work.
I have absolutely no idea where to look for the error, so my question is: can it be that the main.swf (which is the menu for games) could be the problem, or the problem must be in the maze.swf?
Thanx in advance!no, all code is in the first frame of actions layer:
stop();
var rightArrow:Boolean = false;
var leftArrow:Boolean = false;
var upArrow:Boolean = false;
var downArrow:Boolean = false;
var speed:int = 5;
stage.addEventListener(KeyboardEvent.KEY_DOWN, stage_onKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, stage_onKeyUp);
stage.addEventListener(Event.ENTER_FRAME, stage_onEnterFrame);
function stage_onKeyDown(event:KeyboardEvent):void {
if(event.keyCode == Keyboard.RIGHT) rightArrow = true;
if(event.keyCode == Keyboard.LEFT) leftArrow = true;
if(event.keyCode == Keyboard.UP) upArrow = true;
if(event.keyCode == Keyboard.DOWN) downArrow = true;
function stage_onKeyUp(event:KeyboardEvent):void {
if(event.keyCode == Keyboard.RIGHT) rightArrow = false;
if(event.keyCode == Keyboard.LEFT) leftArrow = false;
if(event.keyCode == Keyboard.UP) upArrow = false;
if(event.keyCode == Keyboard.DOWN) downArrow = false;
function stage_onEnterFrame(event:Event):void {
var rect:Rectangle = player.getBounds(this);
var i:int = 0;
var xBump:int = 0;
var yBump:int = 0;
if(rightArrow) {
xBump = speed;
for(i = 0; i < speed; i++) {
if(maze.hitTestPoint(rect.right + i, player.y, true)) {
xBump = i - 1;
break;
if(leftArrow) {
xBump = -speed;
for(i = 0; i < speed; i++) {
if(maze.hitTestPoint(rect.left - i, player.y, true)) {
xBump = -i + 1;
break;
if(upArrow) {
yBump = -speed;
for(i = 0; i < speed; i++) {
if(maze.hitTestPoint(player.x, rect.top - i, true)) {
yBump = -i + 1;
break;
if(downArrow) {
yBump = speed;
for(i = 0; i < speed; i++) {
if(maze.hitTestPoint(player.x, rect.bottom + i, true)) {
yBump = i - 1;
break;
player.x += xBump;
player.y += yBump;
if(rightArrow) {
xBump = speed;
for(i = 0; i < speed; i++) {
if(cilj.hitTestPoint(rect.right + i, player.y, true)) {
xBump = i - 1;
nextScene(); -
Possible to make embedded swf (in another swf) fill browser?
I have an .swf which is set at 100x100 percent and fills the
browser window. I have an embedded .swf within this .swf, and I
would like to be able to have the embedded .swf fill the browser
window and remain fluid (for different screen resolutions). This
has to be done from the embedded .swf.
I thought if I could retrieve the stage details of the parent
.swf from within the embedded .swf, then I could use these to
resize the embedded .swf - but I haven't been able to do this.
I'm plum out of ideas. Can anybody give me any pointers?
Many thanks.I may have my terminology mixed up. I have a pre-compiled
.swf that allows embedding of .swf's from a seperate .xml file via
a LocalConnection API. -
Loading External Swf with Other Swf Dependencies
I'm trying to load an old project into a new project via swf. My old project had local external swf dependencies.In other words A.swf is the old project swf and it loads in B.swf and C.swf. I want to load A.swf into my new project. All the .swf file are local and will be loaded locally. Using the url and loader to load the old project's swf into the new project, I get an error that says that the stage must not be null. I have put A.swf, B.swf, and C.swf all within the same folder together in the new project. Is the correct approach? I'd like to know if this is even possible and if so how should I do it? Thanks in advance!
Hmm I don't believe I have targeted the stage. Here's my code below.
package ExergameShell.screens
import flash.display.Loader;
import flash.events.Event;
import flash.net.URLRequest;
import feathers.controls.Screen;
import starling.core.Starling;
import starling.events.Event;
public class Leaderboard extends Screen
private var url1:URLRequest;
private var loader1:Loader;
public function Leaderboard()
addEventListener(starling.events.Event.ADDED_TO_STAGE, init); // necessary for all screens
private function init():void
url1 = new URLRequest("A.swf");
trace(JSON.stringify(url1));
loader1 = new Loader();
loader1.load(url1);
//Starling.current.nativeStage.addChild(loader1);
//loader1.contentLoaderInfo.addEventListener(starling.events.Event.COMPLETE, resetFPS);
private function resetFPS(event:flash.events.Event):void
Starling.current.nativeStage.frameRate = 60; -
Controlling one swf with another
Ok here's what I'm trying to do. I have speant quite sometime on it but can't seem to find a good resource for the solution.
I have a site I am working on which has a Flash intro. The other pages of the site hold a menu that's created in Flash. For some reason my client wants the ability to go back and view the intro again, which is easily accomplished with navigateToURL. HOWEVER the intro is broken into two distinct parts and I need to target the second part, which would require something along the lines of gotoAndPlay(500); or something to that effect.
What I am having problems with is how do I target a specific frame in a completely different movie, the intro, using a button from the Flash menu within the site. I'll try to explain it a bit easier. The top button on staticMenu.swf, which is placed throughout the site (aboutus.aspx, portfolio.aspx, etc...) needs to target frame 500 of mainIntro.swf which is embedded in default.aspx.
Any help would be greatly appreciated. It make keep me from beating my head off the wall in the future... =)you can pass the frame to play in a query string, use javascript to parse the javascript and use the externalinterface class to evaluate the query string in flash. if it's there, goto frame 500 (assuming frame 500 is loaded - ie, you'll need a preloader), otherwise don't got frame 500.
-
Help with load xml driven swf in another swf
Hello people ... (sorry for my Google transalte English)
... I am desperate, tapping in place last week.
In fact, i make flash CD presentation in Adobe Flash CS5 AS2 (with minimal use of ActionScript). It occurs to me the next problem ... need to load flash image gallery that i already have created, in new presentation file. Gallery was created in Flash Slideshow maker and as products I have. Swf,. Xml and folders with thumbnails and picture (no. Fla file).
The concept of the presentation (as root is concerned) should look like in uploaded picture "izgled otvorenog cd-a". In each of the folder on cd presentation (as on picture) is a Flash presentation controlled by their xml file whose name I must not change. Exe file "Prezentacija 2011" is a presentation (Flash Projector) that i try to make. In the same presentation i create frames and for each of the frames added action:
loadMovie ("02_Kapije/kapije.swf", "kapije_ucitavanje");
kapije_ucitavanje._x = 23;
kapije_ucitavanje._y = 167;
stop ();
(Of course, for each item varies loadMovie root and instance name).
The problem is that presentations can't find xml file, apparently because they do not have the appropriate root. When all the files of the one gallery set in the same folder with the "Presentation 2011.exe" file, everything works normally ( however, as i said, i cannot change the name of Xml file and that disturb the concept of my CD presentation).
How can I drive loaded swf file from the above script to use Xml file in its folder?
HELP PLEASE!!!
P.S. ...and it looks so easyyou're welcome.
p.s. please mark helpful/correct responses. -
Controlling one embedded swf with another
I have a flash website where I am using the loadMovie()
function to load multiple swfs, buttons, etc. into my index.swf
file (so it is easier to update one component than the whole
movie).
I have a series of buttons (home, about, services, etc.) that
in are in a file called "buttons.swf" and are loading into
index.swf. I also have another button called "envelope.swf", which
brings up a screen for a "Tell a Friend about this Page" box. I
would like to have the "buttons.swf" files disabled when when the
"envelope.swf" button is clicked, but I'm not too sure how to go
about doing it BECAUSE it is called through loadMovie.
Can this be done? I know about using enabled=false/true, but
how can I use that when referring to an embedded swf?
Thanks!That's a very wise method of developing your website.
My group uses something like this:
var myComponent:MovieClip =
createEmptyMovieClip("myComponent", getNextHighestDepth());
this.loadClip(src, this.myComponent);
Then when you need to access a function or value in your
component, you just use standard dot notation:
this.myComponent.myFunction(values);
this.myComponent.button1,_width=220;
You can even embed components inside other components. -
Hello, heres what I'm looking to do:
I am trying to create a project completely in flash player,
however its very large (its basically a tutorial for a coding
language called "magic")
I want to seperate it out a bit, basically one main flash
file that acts as a menu system with buttons to send you to
different sections of the tutorial, and then I want to make a bunch
of individual flash files for each page of those sections.
How would I go about calling a swf from within a swf file, or
preferably embedding multiple swf files into the main swf file.
This would allow me to make a bunch of complicated timeline
animations without having a completely unmanageable single
timeline.
Or if you have another possible suggestion on how to more
easily seperate functions/animations I'm certainly open to other
idea's. Thank you in advance!This is pretty simple once you get the hang of it. Create an
empty movieclip and place it on your stage. You can do this with
either code or by actually creating it in your library. Call it
holder_mc. position it where you would like your other movies to
load. Again you can do this by code or by physically moving it.
//This is how to do it with code:
//STEP 1 create your empty movie clip and give it your name/
place it in the next available level
_root.createEmptyMovieClip ( "holder_mc" ,
_root.getNextHighestDepth() )
//position the holder mc
_root.holder_mc._x = 50
_root.holder_mc._y = 50
//create a button and place it in the root - then attach code
that loads your external .swf into your holder mc
homeButton_btn.onPress = function(){
_root.holder_mc.loadMovie("home.swf") } -
Question? How to make one swf initialize another swf?
On my website i would like to have my main swf which has a button that links to a contact form. This main swf is in its own div and i want to have another div with a contact form swf file that i created.
So i want the first swf's contact button to load the contact swf in the other div.
question is how would i change the current contact button from loading a link to a html page into a button that loads the swf in the other div?again,
you need to know some javascript. at least, enough to assign innerHTML to your div or learn some jquery.
then you need to look-up the external interface class.
neither of these are easy if you're just starting with flash and/or just starting with javascript.
i don't think anyone will do this work for you unless you hire someone or find a friend that will do it for you. -
Embedding a SWF inside another SWF
I used inDesign CS4 to develop a catalog of services for the
company I work for. Then exported it to a Flash document with
interactive buttons and page turns. This is the current look:
http://www.directrixsolutions.com/cw
My question in regards to my file is, can you import the .swf
file, which inDesign makes, into a Flash document so that a
preloader for the file can be used? My .swf (packet.swf) is about a
1mb large and so should have a preloader. But, when I import it, or
have an attached .swf within the file that points to my packet.swf,
this is what happens. WARNING: IF YOU ARE PREDISPOSED TO HAVING
SEIZERS, YOU SHOULD PROBABLY NOT CLICK ON THIS LINK. (c8
http://www.directrixsolutions.com/cw/FlashVersion.html
As you can see, the document goes crazy. Any ideas?NedWebs. Yes, I did add that message myself, and it isn't a
virus. I can explain what it is doing if that would be better. When
the FlashVersion of the packet is loaded, it goes through the
preloader, then goes to the packet.swf. But instead of remaining on
the first page of the packet and waiting for instructions from the
viewer on going to the next page. It jumps to the next page, then
to the next and so on. Very quickly. I would have to say that it
goes through the entire 11page packet 3 or 4 times each second. It
is as if when the packet.swf is opened, it goes through each frame
and is on a loop. Maybe the stop(); script for each page is not
being recognized? I have attached the ActiveScript code that I used
within this project. -
How to remove SWFs under another SWF?
Hello!
I'm using the following code to link to other pages:
var loadPage = new Loader();
function loadBiology(e:MouseEvent):void {
addChild(loadPage);
loadPage.load(new URLRequest("biology.swf"));
Now the code works fine and such, this is more of something I'm curious about!
When I use that code, I'm assuming that 'biology.swf' is simply placed over the current SWF that is open (as I can still hear the music even though I've gone away from that particular page). Is this correct?
And then I'm just wondering if there is a simple way to remove that current SWF and replace it with the new one ('biology.swf)? (I use this code in various pages to link them all together, and I think the more a user navigates around the pages it really slows down the whole program!)
I have slight knowledge that in Actionscript 2 you assigned a SWF to a particular layer, but I'm not sure how to go about it in AS3!
Any help is appreciated! (I'm a beginner so please forgive my ignorance!)Assuming that this is on the main timeline, I suggest creating sprites that hold each one of the SWFS that you create, so then you can have something like the following:
var bioHolder:Sprite;
public function addBiologyPage( _url:String ):void{
if( !bioHolder) //holder doesn't exist? create it
bioHolder = new Sprite();
var loadPage:Loader = new Loader(); //create new loader
this.addChild( bioHolder ); //ad holder to parent
bioHolder.addChild( loadPage ); //add loader to holder
loadPage.load(new URLRequest( _url ) ); //load loader
private function removeBioPage():void{
this.removeChild( bioHolder );
bioHolder.removeAllChildren();
bioHolder = null;
That should let you add and remove pages as needed. Then you could set up an array that holds the holder Sprites if you have alot / dynamic pages that you need to manage. -
Stop music playing in one swf when another swf starts
Hello Flash developers please help me here.
On my main SWF Home File i have 2 swf files are loaded into my (main home swf) and everything is runing smooth BUT the problem is when i want to watch the video the music is still playing i have to click on the button to stop music playing.
what i want is when i click on the video to play i want automatically the music to stop playing with out me clicking the mp3 button to stop the music playing.
NOTE
Keep in mind i have 2 SWF files that are loaded in to the main swf file ...
Home SWF is the main file
MP3 SWF << Loads on Home SWF
Video SWF << Loads on Home SWF
All i want is when the video is playing automatically stop the music and when the video is finish the music automatically continuing from where it was left.
Thank you so
AKAoshi1I don't know how to do this. I have 4 files. file one calls file 2 when the Next at the end of file one is clicked, file 2 calls 3, etc. The reverse is true with the first Previous for files 2 - 4. Can I get some guidance?
Thanks -
Loading a SWF inside another SWF question
Hello friends,
1. (IMPORTANT) As all we know when putting some Flash SWF
inside an HTML page, normally it starts playing as soon as its
first frame is loaded.
Now in my case I have to load a SWF (let call it Flash A)
inside another Flash, I used mx.controls.Loader control to do this.
But this internal loaded SWF (Flash A) doesn't display untill it is
completely loaded. Although what is interesting is that if it
contains a sound track I can hear it while it is being loaded.
I wana know is there any way that we can make this Flash
display while being still loaded.
2. Is there anyway to change a Flash playback FPS at runtime?
Thank you so much for any note and help.
- Mdamatrixhasu wrote:
> i want to know how i can load a flash inside another
flash container
go to help - search for 'loadmovie'
Best Regards
Urami
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami>
Maybe you are looking for
-
Does anyone know how to permanently disable the Wi-Fi on an iPhone or iPod touch? I know how to temporarily disable it (tap on "Settings", then tap on "Wi-Fi" and slide the bar to "Off"). Is it even possible to disable it permanently? Alternatively,
-
Oracle Text Index taking Much time for retreiving records
Hi, I an using the context based index on the table with the xmltype column and using the mentioned preferences, fuzzy, stemming and substring. I m also using the INPATH and the HASPATH operators to search on the XML contents. The total no of records
-
Not possible to edit Comm. Structure or Activate transfer rule
Hello Experts, Do you know what is causing the problem in development box we facing? We are neither able to edit Comm. Structure nor activate transfer rule for myself data mast data sources in BW. Basically, it doesn't let us go in edit mode when we
-
Web browser expiration on request
Hello, I'm programming a web application. I have a jsp that call a servlet that search in a database and draw an image from the data found depending on criterias of the user. The problem is : if I try a request that return to much data, I think Inter
-
Hi folks , job cancelled while doing post installation (SGEN ) and 89% job completed.... it show following error ZDATE_ILLEGAL_LOCTIME how can i solve this error ..... give me suggestion regards sathish