Preloader ignores external swf's actionscript
Hey guys
I have an External.swf file that is a video. The swf is 1135 frames long and running just fine by itself, stopping as I want when the actionscript says stop(); on the first frame and looping the end of the clip with gotoAndPlay(837).
The preloader SwfLoader.swf linked to the External.swf shows the percentage of bytes loaded as it should. However, it runs the video (sound playing in the background) while the preloader shows the loading progress I think it's because it doesn't load the first frame first.
Once the external swf is loaded, it plays the video again, still ignoring the first actionscript frame that says stop(); and the last frame gotoAndPlay(837).
Thank you.
Here is the preloader's actionscript on the first and only frame:
import flash.geom.*
import flash.display.*
var loadurl:String = "External.swf";
var nDepth:Number = 0;
var nWidth:Number = 200;
var nHeight:Number = 20;
var nPadding:Number = 3;
var cLoader:MovieClipLoader = new MovieClipLoader();
var oListener:Object = {onLoadInit:onContentLoaded};
var mcLoader:MovieClip = this.createEmptyMovieClip("Loader_MC", 0);
var mcContent:MovieClip = this.createEmptyMovieClip("Content_MC", 1);
var mcLoadBarBg:MovieClip = mcLoader.createEmptyMovieClip("LoadBarBg_MC", nDepth++);
var mcLoadBar:MovieClip = null; //Duplicated later with mcLoadBarBg
var txtPercLoad:TextField = null; //Create after duplication
var cMatrix:Matrix = new Matrix();
mcLoader._alpha = 0;
cMatrix.createGradientBox(nWidth, nHeight, 0, nPadding, nPadding);
cLoader.addListener(oListener);
mcLoader.lineStyle(1, 0x000066, 100);
DrawRect(mcLoader, 0, 0, nWidth, nHeight);
mcLoadBarBg.lineStyle(1, 0x0000FF, 0);
mcLoadBarBg.beginGradientFill("linear", [0x006699, 0x0066FF], [100,100], [0, 255], cMatrix, SpreadMethod.PAD);
DrawRect(mcLoadBarBg, 0, 0, nWidth - nPadding*2, nHeight - nPadding*2);
mcLoadBarBg.endFill();
mcLoadBar = mcLoadBarBg.duplicateMovieClip("LoadBar_MC", nDepth++);
txtPercLoad = mcLoader.createTextField("PercLoad_TXT", nDepth++, 0, 0, nWidth, nHeight);
mcLoadBar._alpha = 80;
mcLoadBarBg._alpha = 30;
Translate(mcTextMask, nPadding, nPadding);
Translate(mcLoadBarBg, nPadding, nPadding);
Translate(mcLoadBar, nPadding, nPadding);
mcLoadBar._xscale = 0;
mcContent._alpha = 0;
mcContent._lockroot = true;
mcLoader._x = Stage.width/2 - mcLoader._width/2;
mcLoader._y = Stage.height/2 - mcLoader._height/2;
txtPercLoad._x = mcLoader._width/2 - txtPercLoad._width/2;
txtPercLoad._y = mcLoader._height/2 - txtPercLoad._height/2;
SetTextFormat(txtPercLoad, "0%");
mcLoader._alpha = 100;
cLoader.loadClip(loadurl, mcContent);
_root.onEnterFrame = function()
var nBytesLoaded:Number = mcContent.getBytesLoaded();
var nBytesTotal:Number = mcContent.getBytesTotal();
var nPercLoaded:Number = Math.round(nBytesLoaded / nBytesTotal * 100);
if(nPercLoaded > 0)
SetTextFormat(txtPercLoad, nPercLoaded.toString() + "%");
mcLoadBar._xscale = nPercLoaded;
function onContentLoaded(Void):Void
//trace(_root + "::onContentLoaded");
SetTextFormat(txtPercLoad, "100%");
cLoader.removeListener(oListener);
delete _root.onEnterFrame;
delete oListener;
delete cLoader;
_root.onEnterFrame = function()
//trace(_root + "::onContentLoaded::_root.onEnterFrame");
var nInc:Number = 5;
mcLoader._alpha -= nInc;
mcContent._alpha += nInc;
if(mcLoader._alpha <= 0) startLoadedContent();
function startLoadedContent(Void):Void
delete _root.onEnterFrame;
mcLoader.removeMovieClip();
mcContent._alpha = 100;
mcContent.play();
function DrawRect(mc:MovieClip, nX:Number, nY:Number, nW:Number, nH:Number, nR:Number)
trace("DrawRect in: " + mc);
if(nR == undefined) nR = 6;
mc.moveTo(nX+nR,nY);
mc.lineTo(nX+nW-nR,nY);
mc.curveTo(nX+nW,nY,nX+nW,nY+nR);
mc.lineTo(nX+nW,nY+nH-nR);
mc.curveTo(nX+nW,nY+nH,nX+nW-nR,nY+nH);
mc.lineTo(nX+nR,nY+nH);
mc.curveTo(nX,nY+nH,nX,nY+nH-nR);
mc.lineTo(nX,nY+nR);
mc.curveTo(nX,nY,nX+nR,nY);
function SetTextFormat(txtField:TextField, sText:String)
var txtFmt:TextFormat = new TextFormat();
sText = "Loading... " + sText;
txtFmt.font = "Verdana";
txtFmt.align = "center";
txtFmt.size = 11;
txtFmt.color = 0x000066;
txtFmt.bold = true;
txtField.selectable = false;
txtField.text = sText;
txtField.setTextFormat(txtFmt);
txtFmt = null;
function Translate(mc:MovieClip, nX:Number, nY:Number):Void
mc._x = nX;
mc._y = nY;
Hi kglad,
The external swf is a movieclip (flv embedded with an AS3 layer to control the timeline) exported as an swf file .
The first frame of the external swf is just stop();
I didn't know the proloader code was AS2 though
The preloader works fine with the external swf locally, but the problem happens when I run them from my server.
The external swf itself and its code works fine from the server, both combined don't, so I guess the problem comes from the preloader. Probably because of the AS being 2 insted of 3.
Similar Messages
-
Will app store approve an app to load external swf containing actionscript code in it?
Will app store approve an app to load external swf containing actionscript code in it?
Hi...It is not in the application bundle...it will be hosted on a server and from there it will be loaded in the application. I had created one sample application where it is loading a swf which is hosted on different server. This swf contained some actionscript code on its timeline. This app was working on ipad. I just wanted to know whether App Store will approve this.
-
Preloader in external swf not working
I have several external SWFs that are loaded into my site and
each one has a preloader. When I run them by themselves the
preloader works fine, but when it is embeded into the main SWF the
preloaders do not work. Any ideas?
here is my actionscript -
lBytes = _root.getBytesLoaded();
tBytes = _root.getBytesTotal();
percentLoaded = Math.floor((lBytes/tBytes)*100);
loader.bar._xscale = percentLoaded;
loader.percent.text = percentLoaded + "% of " +
Math.floor(tBytes/1024) + "K loaded.";
if (lBytes>=tBytes && tBytes>0) {
if (count>=12) {
gotoAndPlay("enter");
} else {
count++;
gotoAndPlay("preload");
} else {
gotoAndPlay("preload");
}I am experiencing the exact same problem on my site -
www.expansiondesign.com
It works in flash player but not when live (tested safari and
firefox)
I don't know if you are using the same script as I am paul.
I execute the following when each image button is pressed:
button1.onRelease = function () {
startLoading("image1.jpg");
which runs this:
function startLoading(whichImage) {
loadMovie(whichImage, "_root.image_holder");
_root.onEnterFrame = function() {
infoLoaded = _root.image_holder.getBytesLoaded();
infoTotal = _root.image_holder.getBytesTotal();
percentage = (infoLoaded/infoTotal*100);
_root.loader._yscale = percentage;
_root.loader._visible = true;
if (percentage>=100) {
delete this.onEnterFrame;
_root.loader._visible = false;
Thanks,
Barton -
Loading external SWF in Actionscript 2
I am creating an animation within Flash CS4 in Actionscript 2.0 / Flash Player 7
At the moment I have a handler (Movie Clip) called myHolder that is used to play other swf files within one main swf file, when called by a button
Within a button that load the swf into the main timeline - For Example
on (press) { loadMovie("BulletTrainDRAFT.swf", myHolder); }
This works fine with bring other swf files into the main swf file timeline, but when I bring a swf file that has video controls for a video within it, they do not respond within the handler when played, but they do work when that swf file is played within its own external flash player window (The video is within a (Movie Clip) on its own timeline within its design fla)
Video buttons - ActionScript 2.0
btnStop.onPress = function(){ _root.vid.stop(); } btnPlay.onPress = function(){ _root.vid.play(); } btn_fastforward.onPress = function(){ _root.vid.nextFrame(); } btn_Rewind.onPress = function(){ _root.vid.prevFrame(); }
I tried ActionScript 3.0 code as well
Pausebtn.addEventListener(MouseEvent.CLICK,pauseHandler); Stopbtn.addEventListener(MouseEvent.CLICK, stopHandler); Playbtn.addEventListener(MouseEvent.CLICK,playHandler);
function stopHandler(event:MouseEvent):void { // Pause the stream and move the playhead back to // the beginning of the stream. video.gotoAndStop(1); } function playHandler(event:MouseEvent):void { // Pause the stream and move the playhead back to // the beginning of the stream. video.play(); } function pauseHandler(event:MouseEvent):void { // Pause the stream and move the playhead back to // the beginning of the stream. video.stop(); }
Problem I have I think, is that a movie the external swf loads on the existing timeline as a child and doesn't unload the timeline resulting the actionscript not functional, but I can't fix this.if the loaded swf with video is an as2 swf, add:
this._lockroot=true
to it's main timeline. -
External .swf Intro ActionScript Problem
I have used a loader component to load to an external .swf
file (an intro animation). Once the external movie finishes playing
I want my parent movie to move to a certain frame on my parent
timeline. Nothing I try seems to work.So I could use the code that you provided in the timeline of
the intro movie that I am loading into my main timeline? -
first try, changed somethings from previous post, tried to
make different changes, instead of using if else tried to set an
onload handler both before and after the loadmovie sentence (not at
the same time of course), copy paste of what goes on each frame
(actionscript 1):
frame 1:
setProperty("", _focusrect, false);
Stage.showMenu = false;
fscommand("showmenu", "false");
fscommand("allowscale", "true");
var mensaje = "0 %";
this.createEmptyMovieClip("pantalla", 0);
pantalla._x = 0;
pantalla._y = 0;
loadMovie("centrino2x.swf", "pantalla");
frame 2
mensaje =
(pantalla.getBytesLoaded()/pantalla.getBytesTotal())*100;
mensaje = Math.round(mensaje)+" %";
play();
frame 3
if (pantalla.getBytesLoaded()==pantalla.getBytesTotal()) {
nextFrame();
} else {
prevFrame();
frame 4:
pantalla.swapDepths(0);
pantalla.play();
stop();
the result: the if else goes right by to next frame, so it
jumps as if the movie was whole loaded, remaining in last frame as
a blank screen till the movie loads. the message appears as 100% in
the half a sec it gets on screen. according to trace, bytes loaded
and bytes total = 0
version 2, i nearly copied it from a tutorial linked from
another post, most of the preloader stuff is nearly exact from the
tutorial, uses movieloader class (actionscript 2)
frame 1:
setProperty("", _focusrect, false);
Stage.showMenu = false;
fscommand("showmenu", "false");
fscommand("allowscale", "true");
var mensaje = "0 %";
this.createEmptyMovieClip("pantalla", 0);
pantalla._x = 0;
pantalla._y = 0;
var cargador:MovieClipLoader = new MovieClipLoader();
var control:Object = new Objetc();
control.onLoadProgress = function(target, loaded, total) {
aviso.text = Math.round((loaded/total)*100)+" %";
control.onLoadInit = function () {
nextFrame();
cargador.addListener(control);
cargador.loadClip("centrino2x.swf", pantalla);
stop();
frame 2:
pantalla.swapDepths(0);
pantalla.play();
stop();
the result: it never changes frame (as if it never finishes
loading), message giving percentage loaded never appears, and
traces on event handlers for listener never come out
i have no idea what %$#"&#" is wrong, i have spend quite
a time on this, which at first seemed like the easiest part, any
pointers?when first executed pantalla.getBytesLoaded is probably 0 as
is pantalla.getBytesTotal() causing your problem.
to remedy, check that pantalla.getBytesLoaded()>0 and that
pantalla.getBytesLoaded()==pantalla.getBytesTotal(). -
Hi,
Every time I have asked this question, people say , just go
online you'll find lots of preloaders out there. Or, its documented
really well in flash help. BUt I still dont get it. Im sure that
anyone who knows actionscript moderately well can figure it out no
prob.
All I want to do is preload 3 external swf's into my main
movie - and I want to include the preloading script in the
preloading script I already have for my main movie. This is the
script Im using (it has a loader bar etc,..).
onClipEvent (load) {
if (_parent.getBytesTotal() == _parent.getBytesLoaded()) {
quickPlay = true;
} else {
preLoad = (_parent.getBytesTotal() * 0.75); //percent to
preload
_parent.stop();
onClipEvent (enterFrame) {
gotoAndStop(loadedIndicatorFrame());
if (quickPlay == true) { //quickly play the anim
if (_currentframe == _totalframes) {
_parent.play();
} else { //wait for the preload
if (_parent.getBytesLoaded() >= preLoad) {
_parent.play();
Can someone help me out here?
Also, if I preload it right at the beginning, do I need to
additionally specify the place (empty mc) that I want to eventually
run it in?
Thanks a million for anyone who can help with this. Please
dont tell me its well document\ed, because although it may, Its
just as hard to figure it out with the documentation, Im not great
at action script.I'm having a similar issue!
I am currently building a web gallery that loads external
.swfs (of each gallery) into movie clip containers within seperate
frames.
Is there any way to preload those .swfs in the background
before they are called upon by going to those frames?
An example of a site I built in this manner can be found
here:
http://gillestoucas.com/
Help! Thanks a bunch! -
Three external SWF's - not smooth. Fla included
Hey geniuses.
I have a main Flash movie that preloads three external SWF's just perfectly. Everything is great...except the 1st movie is not smooth and really slow, the 2nd movie is a little better, and the third movie is the best.
You can see what I mean here.
http://www.tvnstudios.com/loadvis.html
It's a rather simple Flash portfolio...I'm thinking it could be a stacking issue-but I've approached it from so many different ways instead of wasting my time shooting at thin air, I thought I'd give this forum a shot.
How can I make these three movies play smoothly?
I've attached the main movies FLA just to assist.
I'm SO grateful for any assistance!
Best,
-TylerHi Ned.
the link is the page where the main fla exists. That fla is the one i attached. It loads three external swf's into a holder. The three buttons at the top choose which swf is visible on the page. The site just shows the three buttons, and when you click on button 1, 2, or 3, it will either load movie 1, 2, or 3.
The frames per second are all consistent across the board. I attached the .fla just incase there were problems that were visible in the actionscript. It's not a lot of code, so that makes it easy to look at-but I just can't solve this one.
And thank you again for responding!
-Tyler -
I have a main movie (index.swf) that preloads my external SWF
that is a menu button 4.swf
My index.swf has background music (song1) that plays on load.
I also have background music (song2) that plays on my 4.swf
It works fine when I test 4.swf directly however when I load
my main index.swf I do not hear the song2.
I used stopAllSounds(); in my4.swf to stop the background
music (song1) and then load my song2
stopAllSounds();
my_sound = new Sound(sound_loop);
my_sound.loadSound("4.mp3",true);
my_sound.start(0,100);
This has gotten me to get both songs to play when the site is
loaded and when I click on my menu for 4 button all the sound stops
and my song2 never plays.
My actionscript is not very good so any details you can give
would be greatly appreciated.
Thanks much!here is frame 3 of my loader in index.fla
var movie:MovieClip =
_root.StoredActions.Holder.Movies.Holder2.CMovie.duplicateMovieClip("CMovie"
+ n,n);
loadMovie(n+".swf",_root.StoredActions.Holder.Movies.Holder2["CMovie"+n]);
if(n>1){
_root.StoredActions.Holder.Movies.Holder2["CMovie"+n]._x =
3000;
var MovieLoaded = 0;
percent = 0;
frame4
MovieLoaded =
_root.StoredActions.Holder.Movies.Holder2["CMovie"+n].getBytesLoaded();
loadTotal =
_root.StoredActions.Holder.Movies.Holder2["CMovie"+n].getBytesTotal();
percent = int(MovieLoaded/loadTotal*100);
Bar.gotoAndStop(percent);
loadingName = ("Loading... " + percent+ "%" + " of "+ n);
Loadtext_txt.text = loadingName;
if (loadTotal>10) {
if (MovieLoaded>=loadTotal) {
gotoAndPlay(6);
frame6
if (n < _root.StoredActions.nMenus) {
n++;
gotoAndPlay(3);
} else {
gotoAndStop("Stopload");
_root.gotoAndPlay("Play");
I know that the above code is loading all the external swf
and causing the music to start after load. Is there a way to stop
it from loading the sound? -
External SWF dissapears afte sometime
Hi There!
I have a preloader to preload a SWf file, everything works fine, except, when I run html file on any browser, external swf file dissapears after 1-2 minutes,
basically, I put preloader (swf file), on html code, and preload the external swf.
this is the code:
import flash.geom.*
import flash.display.*
var loadurl:String = "external.swf";
var nDepth:Number = 0;
var nWidth:Number = 200;
var nHeight:Number = 20;
var cLoader:MovieClipLoader = new MovieClipLoader();
var oListener:Object = {onLoadInit:onContentLoaded};
var mcLoader:MovieClip = this.createEmptyMovieClip("Loader_MC", 0);
var mcContent:MovieClip = this.createEmptyMovieClip("Content_MC", 1);
var cMatrix:Matrix = new Matrix();
cLoader.addListener(oListener);
txtPercLoad = mcLoader.createTextField("PercLoad_TXT", nDepth++, 0, 0, nWidth, nHeight);
mcContent._alpha = 0;
mcContent._lockroot = true;
mcLoader._x = Stage.width/2 - mcLoader._width/2;
mcLoader._y = Stage.height/2 - mcLoader._height/2;
txtPercLoad._x = mcLoader._width/2 - txtPercLoad._width/2;
txtPercLoad._y = mcLoader._height/2 - txtPercLoad._height/2;
cLoader.loadClip(loadurl, mcContent);
_root.onEnterFrame = function()
var nBytesLoaded:Number = mcContent.getBytesLoaded();
var nBytesTotal:Number = mcContent.getBytesTotal();
var nPercLoaded:Number = Math.round(nBytesLoaded / nBytesTotal * 100);
if(nPercLoaded > 0)
SetTextFormat(txtPercLoad, nPercLoaded.toString() + "%");
function onContentLoaded(Void):Void
SetTextFormat(txtPercLoad, "100%");
cLoader.removeListener(oListener);
delete _root.onEnterFrame;
delete oListener;
delete cLoader;
_root.onEnterFrame = function()
//trace(_root + "::onContentLoaded::_root.onEnterFrame");
var nInc:Number = 5;
mcLoader._alpha -= nInc;
mcContent._alpha += nInc;
if(mcLoader._alpha <= 100) {mcLoader.removeMovieClip();};
function SetTextFormat(txtField:TextField, sText:String)
var txtFmt:TextFormat = new TextFormat();
sText = "Loading Content " + sText;
txtFmt.font = "Arial";
txtFmt.align = "center";
txtFmt.size = 12;
txtFmt.color = 0xff0000;
//txtFmt.bold = true;
txtField.selectable = false;
txtField.text = sText;
txtField.setTextFormat(txtFmt);
txtFmt = null;
Please let me know what I am doing wrong? thanks in advanceIf you keep an eye on the value of mcContent._alpha, you'll see that because you never shut off that second onEnterFrame function, the _alpha property continues to go up until it reaches a maximum and then flips negative, which means it goes invisible. I confirmed this with running your code.
I don't know what the limit is. In Actionscript, when a number limit is reached it is common for it to advance to its opposite limit - basically a looped numeric system. -
Using Flash MX, ActionScript 2:
I’ve been struggling for several weeks, trying to get a preloader to work on a large (~80 MB) photo portfolio file (using the method where the preloader is on frame 1 of the file, and when loading is completed, it jumps to the content). I’ve done countless tutorials, and none seem to work on my presentation. I even tried downloading a trial version of CS4 so I could export every one of the file’s library movie clips and images so that they load on Frame 2 (a feature MX doesn’t have). It takes about 20 seconds for the .exe to load from a CD, and no matter which preloader construction I use, it always seems to appear in the last few seconds before the movie loads completely. During the initial wait time, there’s no indication that anything is happening: no hourglass on the mouse, and not even a blank screen. This is only true for the first time that the file is loaded from the CD; on subsequent loads, the file must already be in RAM, because it loads within a few seconds.
I decided that I’m going to try and make the file which the user clicks on (one named Windows_Portfolio.exe or another called Mac_Portfolio.hqx) the preloader so that it would be tiny, and would load instantly. I want that file to launch the external huge portfolio file (renamed files.swf), keep track of its loading progress, and cycle through a slideshow (10 thumbnail images that transition into each other over 100 frames) proportionally, based upon the percentage of files.swf that had been loaded.
I assume that there should be a loadMovie() or a loadMovieNum() command on the preloader’s timeline to launch files.swf, and that the initial code of files.swf should have some sort of this._parent._visible=false or other way of deleting the preloader on level0. Can anyone explain the steps to me, or direct me to a good Flash MX tutorial that explains how to launch another external swf from a preloader .exe, keep track of its load progress, and delete the preloader .exe once the external swf had been loaded?
Also, I’ve read that, using this construction on a CD, every file has to be in the same place, and that I can’t nest files.swf in a folder named “files,” and reference it with files/files.swf. Is this true?
Thanks for any assistance you can offer.If you know JavaScript (ECMA Script) then you might be able to get it done applying a for loop and a random function
to the for loop if you know how to get a page-loaded request into JavaScript.
But an easier solution, if you know ActionScript 3.0, and if your SWF's don't need to be recoded and can load into a "container" SWF would be to create a master FLA file that loads your SWF's in a random fashion using Math.random() as a multiplier, though you won't see much variation if you only have 2-3 SWF's to load--if you had more than that then you would begin to benefit from the random function's capabilities. In ActionScript 3.0 use the load() method along with addChild() to load the SWF and add it to the stage. You will be able to search for specifics on how to code the FLA properly by using Flash's Adobe Help tool and also using an internet search.
-markerline
P.S. Once you have the master FLA coded you can Publish it to an SWF and an HTML and if the container/master SWF needs to be in a page with other content you can simply copy and paste the object and embed tags for the container SWF from the published HTML into any place on your master HTML that you need it to reside. You can then use CSS to control placement of the SWF object if it is in a div tag. -
Runnng external swf Actionscript while in fullscreen mode
I am using Flash 9.0 (CS3 Pro). I am coding in Actionscript
3.0
I have two swf files, both interactive. During playback of
the, a mouse event launches the second. I also want the mouse event
to trigger a switch to fullscreen mode. The second swf is
non-linear and requires user input to jump to the appropriate frame
of the timeline. Everything tests and runs perfectly during
standard screen mode but whenever I try to load and play the
external swf file in fullscreen mode, Flash recognizes the
actionscript built into the original SWF but ignores all of the
Actionscript (this.stop(), this.gotoAndPlay(), etc.) embedded in
the second (external) swf file.
How can I get external swf files to load with their scripted
functionality in fullscreen mode?
Thanks for the help.
Aaron
The code I am using is:
// --- this is the code contained in the first swf file
// function to launch second SWF file
function movieLaunch(event:MouseEvent):void
// Sets display mode to fullscreen. With this line present,
Flash does not look at any Actionscript in ip.swf
// If I comment the below line out, the second SWF plays
correctly and has full functionality
stage.displayState = "fullScreen";
// load and launch second movie (ip.swf) which is located in
the same directory
var request:URLRequest = new URLRequest("ip.swf");
var loader:Loader = new Loader();
loader.load(request);
addChild(loader);
// Sets the listener for the button that will launch the
second movie.
launchMovieButton.addEventListener(MouseEvent.CLICK,
movieLaunch);
TextThe keyboard is disabled in fullscreen mode. This may be
causing the problem? -
Both main movie and external swf preloader - confusion!
Hi there!
I have a webite with my main movie (88kb) and an external swf
soundloop (1mb). I made a preloader, but it only loaded the main
movie, meaning that after the intro, the soundloop would not start.
I loaded the soundloop onto level 1, and then tried to make a
preloader with this code (I thoguht it worked but it really was a
total guess).
stop();
this.onEnterFrame = function() {
bl = _level1.getBytesLoaded()+this.getBytesLoaded();
bt = _level1.getBytesTotal()+this.getBytesTotal();
if (bt<=0) {
bt = 99;
bar.gotoAndStop(Math.floor((bl/bt)*100));
if ((bl == bt) && (bt>0)) {
delete this.onEnterFrame;
gotoAndPlay("Intro", 1);
Now when I test the movie, everything loads, but when the
soundloop is loaded after the intro, the preloader movie clip
appears and starts playing and repeating itself!
How on earth do I get rid of this?! You can see the problem
here:-
http://www.vanitee.co.uk/princess.swf
Thanks in advancePlease! Still in great need of help. Have tried all sorts
=( -
Preload extern swf results in weid behavior. It this normal?
Hello,
I tried to load an external swf file. In this swf file i have an embeded movie so that i see the preloader in action.
What happens is, that while preloading i hear the movie playing in the background.
So when the external swf is at for example 20% preloading the timeline is already playing in the external swf.
Isn't that weird?
I also noticed that the Event.INIT get's executed sooner for example at 17% progress. This should be at 100% is it not?
And in CS3 i get the error while previewing the bandwidth profiler:
Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed.
Does anyone know what is going wrong?
Regards,
Chris
This is the code i use:
package {
import flash.display.LineScaleMode;
import flash.display.DisplayObject;
import flash.net.URLRequest;
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.display.MovieClip;
* @author chris
public class PreloadMain extends MovieClip {
private var _loaderSprite:Sprite;
private var _request : URLRequest;
private var _loader : Loader;
private var _myMovie:Sprite;
public function PreloadMain() {
addEventListener(Event.ADDED_TO_STAGE, init);
private function init(event:Event):void {
_request = new URLRequest("../swf/main.swf");
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress, false, 0, true);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadingComplete, false, 0, true);
_loader.contentLoaderInfo.addEventListener(Event.INIT, loadInit)
_loader.load(_request);
drawLoader();
private function drawLoader():void {
trace("draw");
_loaderSprite = new Sprite();
_loaderSprite.graphics.lineStyle(1, 0x000000,1,false, LineScaleMode.NORMAL );
_loaderSprite.graphics.beginFill(0x0000FF, 1);
_loaderSprite.graphics.drawRect(0, 0, 150, 20);
_loaderSprite.graphics.endFill();
_loaderSprite.x = stage.stageWidth/2 -_loaderSprite.width/2 ;
_loaderSprite.y = stage.stageHeight/2 - _loaderSprite.height/2;
addChild(_loaderSprite);
function loadProgress(event:ProgressEvent):void
var percentLoaded:Number = event.bytesLoaded / event.bytesTotal;
percentLoaded = Math.round(percentLoaded * 100);
_loaderSprite.scaleX = percentLoaded/100;
trace("loaded " +String(uint(percentLoaded)) + "%" );
//this.percentLoaded.text = String(uint(percentLoaded)) + "%";
function loadingComplete(event:Event):void
removeChild(_loaderSprite);
_myMovie = Sprite(_loader.content);
addChild(_myMovie);
_loader.contentLoaderInfo.removeEventListener( ProgressEvent.PROGRESS, loadProgress);
_loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, loadingComplete);
_loader = null;
trace("Load Complete");
function loadInit(event:Event):void {
trace("load Init");It is normal to receive Event.INIT before Event.Complete because on Init event you may access as3 on loaded swf, but the symbols of library may still downloading.
-
External swf. preloader blues
Hiya,
I've just finished a website which is nearly ready to go
live, all except the preloader. I need to have external swfs
preload before running, and after going through a few tutorials and
threads, I'm pretty sure that my website is constructed in such a
way as to make it difficult to impliment the tutorials into my
work.
I've attached 2 fla. files (the main parent and one of the
external files. ), and would be really greatful if someone could
take a look at them and let me know how I could create a preloader
for the exteranl files (in the attachement's case the
"visual.fla").
Thanks a million for your time.
...Probably obvious, but the visual.swf is launched when the
"visual" button is pressed on the main home.swf.
Cheers!
http://www.yousendit.com/transfer.php?action=download&ufid=B95706E71E2DB94E&rcpt=goodwalla [email protected]did you manage to do this?
If yes, then please let me know how you did it, cause I also
want this
10x
Maybe you are looking for
-
How Can I See Who Is Logged In To My Server
+I posted this in the wrong forum, so pardon me if you've already read this as I am now re-posting it in the correct forum:+ I am running Mac OS X Server Snow Leopard 10.6.4 on a Mac Pro (2 x 2.93 Quad Core Xeon, 8GB RAM). I figured out how to see ho
-
Foreign Key Constraint Failure on Self-Referencing Table
In a recent data deletion project, I ran into a problem where Oracle allowed for a record (the parent) to be deleted when there still existed a child record in the same table which referred to the parent. An abbreviated version of the table is as fol
-
How do I alter this code?
This code makes an external text file scroll on the stage. I would like to alter it so that it continues to scroll while the mouse is down, as moving the text a tiny bit on each mouse click seems useless to me. Thanks, jcarruth. var external_txt:Text
-
Uploading my dynamic site to Netfirms MySQL
I created a dynamic site in CS5.5, using XAMPP to make it locally. After putting it on my Netfirms-hosted remote server, I get an error saying: Warning: mysql_pconnect() [function.mysql-pconnect]: Can't connect to local MySQL server through socket '/
-
Want to get Run By from CI_INFOOBJECTS
Developed a Java SDK web application. In report details page have three columns SI_KIND , SI_CREATION_TIME , SI_NAME want to add one more column Run By. How to get it. Thanks in Advance