ProgressEvent.Progress - How To Detect Which Loader Called Me
Evening.
I have a ProgressEvent.PROGRESS event listener, used by four individual loaders, which load images into seperate movieclips once loaded.
Each of my seperate movieclips are to have preloaders, modified during the progress process. This means the progress function needs to know which loader called it.
If I attempt to detect ev.target.loader, I get the following error:
ActionScript Code:
Error: Error #2099: The loading object is not sufficiently loaded to provide this information.
at flash.display::LoaderInfo/get loader()
at About/loadProgress()
Short of making four seperate progress functions (yuck), how can I get the progress function to detect which loaders ProgressEvent called it??
Any help would be greatly appreciated, thanks.
ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 08-23-2008, 09:47 AM
View Complete Forum Thread with Replies
Sponsored Links:
ProgressEvent.PROGRESS -parent?
Hello hello
I have a problem which I have encountered before in a different project. That time I solved it the ugly way, I dont want to do that again. Thats why Im here
This code adds three loadbars to the stage and then starts to load three images. Off course I want each of the loadbars to show the progress of each of the images loading. The problem is that I dont know how to tell the loadProgress-function what progressbar to update since there are three.
I know that the following code must be changed:
Code:
this["laddningsInstans"+aktuellInstans].stapel.width = percentLoaded*1.675;
The "aktuellInstans" must be replaced. I wished I could write e.parent. But it seems that it does not work with ProgressEvent.PROGRESS -events.
Any ideas what to do guys?
Code:
var aktuellInstans = 0;
addToStage("emser.jpg", 20, 30);
addToStage("bild1.jpg", 200, 30);
addToStage("bild2.jpg", 400, 130);
function addToStage (filename, yPos, xPos){
aktuellInstans++;;
var url:URLRequest = new URLRequest(filename);
var loader = new Loader();
loader.load(url);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
addChild(loader);
loader.x = xPos;
loader.y = yPos;
//loaderBild.contentLoaderInfo.addEventListener(Event.COMPLETE, loadDone);
laddningsInstans(aktuellInstans)
}
function laddningsInstans (aktuellInstans){
trace("aktuellInstans: "+aktuellInstans)
this["laddningsInstans"+aktuellInstans] = new laddningsInstans_();
var tempIns = this["laddningsInstans"+aktuellInstans];
addChild(tempIns);
tempIns.x = stage.stageWidth/2-tempIns.width/2;
tempIns.y = 200+(aktuellInstans*30);
tempIns.name = "laddningsInstans"+aktuellInstans;
}
function loadProgress(e:ProgressEvent):void {
var percentLoaded:Number = e.bytesLoaded/e.bytesTotal;
percentLoaded = Math.round(percentLoaded * 100);
trace(percentLoaded);
trace(this.getChildAt(aktuellInstans).name)
this["laddningsInstans"+aktuellInstans].stapel.width = percentLoaded*1.675;
}
View Replies !
View Related
LoaderInfo And ProgressEvent.PROGRESS
Hi.
I'm working on a project where I have to preload several .swfs. I created a custom class (myLoader) that extends the Loader class and adds it a few string variables with data I need. To each instance's contentLoaderInfo I add event listeners for ProgressEvent.PROGRESS and assign the same event handler function.
The problem is, I need to access the myLoader instance from the event handler, but so far I haven't been able to, not until it finishes loading.
I'm not an expert on the AS3 event model, but the ProgressEvent.PROGRESS is not a bubbling event so I don't think I can listen to it from the Loader instance itself, for example.
I'm really stumped with this, don't know why the LoaderInfo object can't access the Loader immediately, since the Loader instance creates it in the first place. The url property returns "null" also.
Any help in this matter is very appreciated.
Code:
//Event handler.
private function _progressHandler ($evt:ProgressEvent):void {
trace ($evt.target);
trace ($evt.currentTarget); // both return [object LoaderInfo]
trace ($evt.target.loader);
trace ($evt.currentTarget.loader); //both return Error #2099: The loading object is not sufficiently loaded to provide this information.
trace ($evt.target.url);
trace ($evt.currentTarget.url); //both return null
}
View Replies !
View Related
LoaderInfo And ProgressEvent.PROGRESS
Hi.
I'm working on a project where I have to preload several .swfs. I created a custom class (myLoader) that extends the Loader class and adds it a few string variables with data I need. To each instance's contentLoaderInfo I add event listeners for ProgressEvent.PROGRESS and assign the same event handler function.
The problem is, I need to access the myLoader instance from the event handler, but so far I haven't been able to, not until it finishes loading.
Any help in this matter is very appreciated.
View Replies !
View Related
Does The ProgressEvent.PROGRESS Works Only Online?
Hallo!
Does the ProgressEvent - stuff like
dispatcher.addEventListener(ProgressEvent.PROGRESS, grosseAugen);
only works when the page is online? I try to use it, and it only works as a trace-information but not when i use it in a textbox (i think) in a container on stage. When it's a offline tool too, i will try it a little bit longer, if nor, i can do other usefull things.
Thanks!
View Replies !
View Related
[F8] Detect PAGE That The Swf Is Called From?
Developing in Flash 8, but would (slightly) prefer to export as Flash 7 for compatibility. ActionScript 2. Hosting my own SWFs, but will be displayed on other people's sites/pages hosted elsewhere.
Is there ANY easy way for an SWF to detect what page is calling it?
Basically, I am making a Flash widget and people will come to my site and copy the code that I give them and paste it on their sites. (Blogs, MySpace pages, real sites, forum headers, etc.)
I need to know "what page just displayed this swf?" NOT "where is the swf itself hosted?"
Did I make that confusing?
I do not always have the flexibility to add a call to JavaScript.
I know mochibot uses code to tell me where the swf is hosted, but I don't need that. I need to know what page a visitor is viewing that is calling my swf.
Ideas, anyone?
View Replies !
View Related
Way To Detect Inefficient Sections Of Code (or Just Which Parts Are Called The Most)?
Is there something built into Flash 8 that can help me detect which parts of my code get run the most?
I'm making a game that starts to slow down after a certain number of moving objects are on the screen. At first it would slow down with only a few objects, but i've been working real hard on making it more efficient and now i have it so that it doesn't slow down until about 18 objects, but i still want to improve upon this.
Anyway, it would be SO much easier if i could say, play my game for a while and then when i was done Flash would tell me how many times each line of my code was called during that session. Then i could look at the lines that are getting called the most and see if i can make it so they are called less.
Any ideas?
View Replies !
View Related
Pre-loader / Progress Bar
Hi.
I'm trying to place a sort of preloader / progress bar in my main fla. I'm loading a bunch of swf's into an empty movie clip instance called "body" upon the users request. I know how to make a preloader that resides in the first scene of a swf but I would like the preloader to reside inside the main flash file and not within each movie. Is this possible and does anybody have some code.....
Something like getbytesloaded.....but can I yse that for an empty movie clip?
Thanks much...
Mik
View Replies !
View Related
Loader And Progress Bar
Hi,
I have a directory full of SWF files and I want to design a movie that will allow each one to be displayed in flash as a sequence stopping between each one until a user action moves the movie onto the next one.
These files are fairly large renders from plasma at around 1/2 to 2MB hence the need for a preloader.
Do I need to setup one movie per scene or is there a more dynamic way of pulling in the contents of the SWF directory to display in a movie?
View Replies !
View Related
Progress Bar (not A Loader)
Ok, first this isnt a loading progress bar is a bar that just shows you how far along the video is into playing.
how would I create a bar that would show a duration of a clip and have a fill keep getting bigger til it gets to the end. I also have these videos on an array so there are multiple. The bar length and duration would have to change with each video...
can someone help me create this?
-Ronnie
View Replies !
View Related
Progress Loader
Hi,
In my application there are certain tasks that take about 5 or 10 seconds to finish. I would like to show the progress of the task to the user, like a progress bar or something. How do I do this?
Now correct me if I am wrong, this is not relatedt to a preloader which is having another SWF loading your application SWF and showing the progress, is that it?
Thanks
Jorge
View Replies !
View Related
FLV Progress Loader Within A SWF
I have a swf as a main page. I have created a flvplayer placeholder (by importing video) within the main page fla. The intent is for this welcome video to play and then for the main page flash to work as normal.
Carousel.swf is the main page. The timeline (blank-flvloader placeholder) runs long enough for the flv to play, then at about frame 150 the main page starts. The video is xxx.flv (1 MB) that should preload and play first (BEFORE that blank flvloader period). Note that there is a buffer setting within the flvplayer that I assume will allow some preloading before playing. This seems to work great. The problem is that I want the user to see a progress bar instead of seeing a blank background while the video is loadinguffering.
I used the code belowattached to get started. I created the fla as it states (http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001582.html)
I am unsure where to use this code. I have tested it with my URL target and it works. I thought about dragging it on top of the placeholder?? How can this preloader load the flv with a progress indicator, then continue on with the main page once preloaded and played? Should I use the preloader fla, or just use the code, etc.? Please excuse the loose terminology.
To recap: Carousel.fla has a flvplaceholder that calls an external flv for an intro video that plays first, then the timeline continues on to the main flash. This is all in the same html page.
Attach Code
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
my_video.attachVideo(stream_ns);
stream_ns.play("http://www.helpexamples.com/flash/video/typing_short.flv");
this.createTextField("loaded_txt", this.getNextHighestDepth(), 10, 10, 160, 22);
this.createEmptyMovieClip("progressBar_mc", this.getNextHighestDepth());
progressBar_mc.createEmptyMovieClip("bar_mc", progressBar_mc.getNextHighestDepth());
with (progressBar_mc.bar_mc) {
beginFill(0xFF0000);
moveTo(0, 0);
lineTo(100, 0);
lineTo(100, 10);
lineTo(0, 10);
lineTo(0, 0);
endFill();
_xscale = 0;
}
progressBar_mc.createEmptyMovieClip("stroke_mc", progressBar_mc.getNextHighestDepth());
with (progressBar_mc.stroke_mc) {
lineStyle(0, 0x000000);
moveTo(0, 0);
lineTo(100, 0);
lineTo(100, 10);
lineTo(0, 10);
lineTo(0, 0);
}
var loaded_interval:Number = setInterval(checkBytesLoaded, 500, stream_ns);
function checkBytesLoaded(my_ns:NetStream) {
var pctLoaded:Number = Math.round(my_ns.bytesLoaded / my_ns.bytesTotal * 100);
loaded_txt.text = Math.round(my_ns.bytesLoaded / 1000) + " of " + Math.round(my_ns.bytesTotal / 1000) + " KB loaded (" + pctLoaded + "%)";
progressBar_mc.bar_mc._xscale = pctLoaded;
if (pctLoaded>=100) {
clearInterval(loaded_interval);
}
}
View Replies !
View Related
Loader/Progress Bar
I setup a progress bar that works when a SWF is loaded. If I use the URL http://www.rivahrealty.com the loader doesn't move but the movie does load. If I use http://www.rivahrealty.com/index.html the progress bar goes from left to right and the movie loads like it's supposed to. I've been trying to figure this out for 3 days. Can anyone help me with this?
View Replies !
View Related
Progress Bar & Loader
Hi all,
I am very new to Flash. I am running Flash MX 2004 Professional and have just created a photogallery, by following the wonderful tutorial on this site listed below.
http://www.kirupa.com/developer/mx/photogallery.htm
I see that Flash has a component add in feature for a loader and a progress bar. Is their an easy way to implement either one, that would go hand and hand with the tutorial above?
Thanks for your guidance in advance!
View Replies !
View Related
Progress Bar & Loader
Hi all,
I am very new to Flash. I am running Flash MX 2004 Professional and have just created a photogallery, by following the wonderful tutorial on this site listed below.
http://www.kirupa.com/developer/mx/photogallery.htm
I see that Flash has a component add in feature for a loader and a progress bar. Is their an easy way to implement either one, that would go hand and hand with the tutorial above?
Thanks for your guidance in advance!
View Replies !
View Related
Progress Bar / Loader Component
I want to preload a swf-movie and use the progressbar component.
Right now I have layer1-frame1 containing the progress bar component (modeolled, source:loader) and layer2-frame2 containing a Loader-component (named:loader, content path:movie.swf) )
The help file says something like that.
But it doesnt work.
Anyone here who can help???
View Replies !
View Related
Progress Bar / Loader Component - Example Please
I have expreimented with this for two days now...
and it should be so easy...
I am sure one of you guys could make this for me in a minute so I can have a look behind and see how exactly this is done:
Can't somebody make me a .fla-file with a Progress Bar component linked to a Loader component, that loads an external swf ??
My problem is that the Progress Bar does not show the correct value, my loader content starts to play when the progress bar shows about 80% loaded!!
View Replies !
View Related
Problem With Progress Bar And Loader
I am having a problem with my progress bar and my loader componets. The Progress bar does not display the progress, but it does go away when the file is loaded. I tried to make the site with only one loader and one progress bar with by setting the .contentPath = "file.jpg"; but the progress bar was still visible after the file.jpg was finished loading.
On one frame I have a Loader called webLoaderArchaio and a ProgressBar called myProgressBarArchaio. Here is my code from the frame webArchaio.
//ProgressBar
myProgressBarListenerArchaio = new Object();
myProgressBarListenerArchaio = function (eventObject) {
myProgressBarArchaio._visible = false;
myProgressBarArchaio.removeEventListener("complete ", myProgressBarListenerArchaio);
};
myProgressBarArchaio.addEventListener("complete", myProgressBarListenerArchaio);
myProgressBarArchaio.mode = "polled";
myProgressBarArchaio.source = webLoaderArchaio.Loader;
On the next frame I have a Loader called webLoaderSTPR and a ProgressBar called myProgressBarSTPR. Here is my code from the frame webSTPR.
//ProgressBar
myProgressBarListenerSTPR = new Object();
myProgressBarListenerSTPR = function (eventObject) {
myProgressBarSTPR._visible = false;
myProgressBarSTPR.removeEventListener("complete", myProgressBarListenerSTPR);
};
myProgressBarSTPR.addEventListener("complete", myProgressBarListenerSTPR);
myProgressBarSTPR.mode = "polled";
myProgressBarSTPR.source = webLoaderSTPR.Loader;
here is the code for the buttons
btnSTPR
on(release){
_root.gotoAndStop("webSTPR");
}
btnArchaio
on(release){
_root.gotoAndStop("webArchaio");
}
thanks
Donald
View Replies !
View Related
[MX04] Progress Bar & Loader
Hi guys.
I'm doing a site for a photographer, and i'm loading the images using the loader component. Some of them are quite large, and auto-scaled to the size of the gallery. I want to use the progress Bar component, but don't know how.
My loader instance name is "galleryloader". I already made it work, I just want a loading bar to show how much of the image is loaded.
Thanks in advanced,
Aaron
View Replies !
View Related
[F8] Music Loader Progress?
Hello there.
I'm trying to build a progress bar the shows how much of an external mp3 has loaded.
the bar instance is an mc named "mpBar" , which is nested in a mc named "mcmpb".
I tried to set the inital _x property to 0, and then have it increment based on getbytsloaded/getbytstotal; but it's not showing working (it starts out in the 100% position).
My code is as follows
var nLoadProgressInterval:Number;
_root.mcmpb.mpBar.setProperty("_root.mcmpb.mpBar", _xscale,0);
function checkLoadProgress():Void {
mBytes = _root.sndAudio.getBytesLoaded()/_root.sndAudio.getBytesTotal();
setProperty("_root.mcmpb.mpBar", _xscale, mBytes);
}
and on the button I have a call to the function like this
_root.track3.onRelease = function():Void {
nLoadProgressInterval = setInterval(checkLoadProgress, 100);
}
Any help here?
View Replies !
View Related
Working With The Loader And Progress Bar
Hi
Im using the loader component and the progress bar together to load into my root movie external SWFs ...
Everything works great - ive created a function such as:
function changeContent(newMovie) {
myLoader.load(newMovie);
showProgressBar();
}
So from anywhere I can change my loaders content and show up the progress bar... the problem I have is once you have been through the movie, if you try to load one of the SWF's again they load up very quickly - because they are in the cache/memory ... the problem here is, my progress bar flashes up for a second and then goes off....
Is there some way I can work out if a loaded content is already in the cache - if I know this, then i can set the progress bar not to even bother showing up.
thanks a lot
View Replies !
View Related
[F8] Progress Bar And Loader Components...
Hi there I'm having a little trouble with using the progress bar with the loader component.
I have them both in a movieclip and they work fine when you test just the movieclip, but as soon as I put the movieclip in a scene the progress bar doesn't work anymore.
Here's the code...
myProgressBarListener = new Object();
myProgressBarListener = function (eventObject) {
myProgressBar._visible = false;
};
myProgressBar.addEventListener("complete", myProgressBarListener);
myProgressBar.mode = "polled";
myProgressBar.source = "my_loader";
myProgressBar.conversion = "1";
myProgressBar.label = "LOADING %3%%";
myProgressBar.direction = "right";
myProgressBar.labelPlacement = "bottom";
my_loader.loadMovie("http://media.ft.com/cms/3a00e22e-8312-11dc-b042-0000779fd2ac.swf", true);
Like I said when I test the movieclip the progress bar work aas it's supposed to and disappears when loaded. However when I put the movieclip on the stage the progress bar bar stays at 0% and doesn't disappear when movie starts to load in.
Am I missing something?
Best
Steve
View Replies !
View Related
Music Loader Progress?
Hello there.
I'm trying to build a progress bar the shows how much of an external mp3 has loaded.
the bar instance is an mc named "mpBar" , which is nested in a mc named "mcmpb".
I tried to set the inital _x property to 0, and then have it increment based on getbytsloaded/getbytstotal; but it's not showing working (it starts out in the 100% position).
My code is as follows
var nLoadProgressInterval:Number;
_root.mcmpb.mpBar.setProperty("_root.mcmpb.mpBar", _xscale,0);
function checkLoadProgress():Void {
mBytes = _root.sndAudio.getBytesLoaded()/_root.sndAudio.getBytesTotal();
setProperty("_root.mcmpb.mpBar", _xscale, mBytes);
}
and on the button I have a call to the function like this
_root.track3.onRelease = function():Void {
nLoadProgressInterval = setInterval(checkLoadProgress, 100);
}
Any help here?
View Replies !
View Related
HELP W/ Progress Bar (loader) For A Component
Hi all,
Hope someone can help.
I created a website with a component. I am not that great with code.
• I have a swf which I placed in an html page.
• There's a lot of images.
• They load from an xml file.
• I need a preloader to display while the images load.
Since I am using a "COMPONENT" I have no idea how to create a preloader or progress bar to display while the images load. Any help would be much appreciated! Thank you!
View Replies !
View Related
Loader And Progress Bar Synch Probs
loader.autoLoad = false;
loader.content = "intro.swf";
pBar.source = loader;
loader.load();
Ok... i have this code a loader a progress bar and 2 probs:
My first prob is that the movie in the loader starts playing before the progress is completed resulting not to able to see what is palyed before it reaches 100% while the movie has already started playing ... in a few words no synchronization between the progress bar and the loader...
The second is that i if i put the progress bar behind the loader so that it will be covered by the loader content once loaded the progress bar won't show it's progress and will remain on 0% even though it's loading the content...
So what i need is a script that will allow me to have the prog bar in front of the loader and once the content is loaded the prog bar will disappear and not remain over the loaded movie.
I hope im not asking too much but it's kind of urgent and any help will be very appreciated.
View Replies !
View Related
HOPELESS - Using Progress Bar/Loader Components
Hello everyone!
I'm about to start tearing my hair out, and I would be forever grateful for some expert advice.
I am using Flash 8, and want to use a single instance of the loader component with a single instance of the progress bar component to preload multiple external SWFs. I have it working fine for the first SWFs loading in, but when I try to preload in a different SWF further down the timeline using the same loader instance and progressbar instance it doesn't work.
If you can direct me to a tutorial of some kind or put me in the right direction I would be stoked.
Here is the code i'm using for the first external SWF:
PreloaderBar.setStyle("themeColor", 0xD51729)
PreloaderBarListener = new Object();
PreloaderBarListener = function (eventObject) {
PreloaderBar._visible = false;
};
ContentLoader.scaleContent = false;
ContentLoader.contentPath = "home.swf";
PreloaderBar.addEventListener("complete", PreloaderBarListener);
PreloaderBar.mode = "polled";
PreloaderBar.source = "ContentLoader";
PreloaderBar.direction = "right";
stop();
Then for the next SWF I want to load in I have added a keyframe in my actionscript layer further down on the timeline and inserted this code:
PreloaderBar.setStyle("themeColor", 0xD51729)
PreloaderBarProductsListener = new Object();
PreloaderBarProductsListener = function (eventObject) {
PreloaderBar._visible = false;
};
ContentLoader.scaleContent = false;
ContentLoader.contentPath = "products.swf";
PreloaderBar.addEventListener("complete", PreloaderBarProductsListener);
PreloaderBar.mode = "polled";
PreloaderBar.source = "ContentLoader";
PreloaderBar.direction = "right";
stop();
Just changing the contentPath to a different SWF
Please let me know if this is the right way to go about doing this, if there is an easier way, or if my code is completely wrong.
Thanks!
Quinn
View Replies !
View Related
(pre)loader Progress Bar Doesn't Appear Until 90% Complete
In the site I'm building, all the code and elements are in frame 2 of the main timeline.
Frame 1 contains a preloader, which is supposed to display loading progress while the user waits for all the frame 2 stuff to load.
For some reason, the preloader doesn't appear until loading of the entire swf is 90% complete, at which point it appears at 90% and completes its progress.
Here's the preloader:
Code:
stop();
var sw:Number = stage.stageWidth;
var sh:Number = stage.stageHeight;
var preLoaderWidth = 150;
preloader_mc.x = (sw - preloader_mc.width) / 2;
preloader_mc.y = (sh - preloader_mc.height) / 2;
addEventListener(Event.ENTER_FRAME, loading);
function loading(event:Event) {
var bytestotal = stage.loaderInfo.bytesTotal;
var bytesloaded = stage.loaderInfo.bytesLoaded;
preloader_mc.preloaderBar.width = Math.round(bytesloaded * preLoaderWidth/bytestotal);
if (bytesloaded >= bytestotal) {
gotoAndStop(2);
removeEventListener(Event.ENTER_FRAME, loading);
removeChild(preloader_mc);
}
}
Is there some way to get the preloader to display before the swf is loaded? To somehow force its display to take precedence over loading all the stuff that happens on frame 2?
Or do I need to rip all the frame 2 stuff off into a separate external swf?
- Bob
View Replies !
View Related
Loader / Progress Bar Component Issues.
I have a Loader component in a movieclip and a Progress Bar component in a movie clip.
Instance name of Loader is ThumbLoader
Instance name of Progress Bar is Progress_bar
I have the following code which works fine in the authoring and bandwidth simulation environment.
But doesn't work in the real life through the HTML page.
Code:
ThumbLoaderListener = new Object();
ThumbLoaderListener.progress = function(eventObject) {
Progress_bar.setProgress(ThumbLoader.percentLoaded, 100);
};
ThumbLoader.addEventListener("progress", ThumbLoaderListener);
Then I tried the following which also didn't work.
Code:
Progress_bar.mode="polled";
Progress_bar.source=ThumbLoader;
Then came across the issue between the Loader & Progress Bar components here http://www.macromedia.com/cfusion/kn...fm?id=tn_19442
Code:
Flash TechNoteProgress Bar does not sync with Loader Component in a movie clip
Issue
When a ProgressBar component and a Loader component are in the same movie clip, and the ProgressBar component links to the Loader component using a relative link, the ProgressBar component will not show the correct percentage corresponding to the Loader component's status.
Reason
If you simply add the name of the Loader—for example, myLoader—in the ProgressBar Component Inspector, the component's source actually points to _parent.myLoader. The ProgressBar is therefore unable to locate the Loader component.
Solution
When you use the Component Inspector to set the source, the source is defined to use a relative path. However, since an absolute path is required, make sure to specify one when using the Component Inspector to set the source. For example, if linking to the same Loader component (myLoader), and both components are in a movie clip named mcName, set the source to mcName.myLoader.
Last updated: July 26, 2004
The solution according to Macromedia is
Code:
Progress_bar.source=MovieClipInstance.ThumbLoader;
Now I have three movieclips (Thumb1_mc, Thumb2_mc, Thumb3_mc) and the Loader & Progress are inside those three move clips. How to set the Progress_bar.source=???
I am really confused.
It seems the progress event of the loader doesn't work at all.
Somebody please give me a workaround or some solution.
I did lot of searching in the net for this issue and found no solution. Please help me.
Kannan.
View Replies !
View Related
Loader Issues With Progress Text
hello guys,
this site rocks by the way, i am learning a ton. So thanks and keep it up.
My problem right now is that i created a loader and it works but i wanted to modify it a little bit by having the load percentage display text to rotate along with the circular progress bar. The thing is that i can't figure out what is wrong with the code, it works well when it is on the main timeline but when i insert it in a movie it stops working.
on my site below, i included the fla and the swf for both the working version and the modidied one (with the MOD at the end of the file name).
http://www.nicolaszein.com/flash/!/
thanks for everything and i hope you guys can help me with this.
ciao
View Replies !
View Related
AddChild To A Loader Progress Target
I want to display a loader when the progress is happening
so i have
Code:
var la:LA = new LA();
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, fademein);
mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress);
function showProgress(e:Event):void {
e.target.parent.addChild(la); // error.. i also tried e.target.addChild(la)
trace("loadeing"); // traces fine
}
I know this is something thats done all the time.. i just cant figure it out
View Replies !
View Related
Loader / Progress Bar Component Issues.
I have a Loader component in a movieclip and a Progress Bar component in a movie clip.
Instance name of Loader is ThumbLoader
Instance name of Progress Bar is Progress_bar
I have the following code which works fine in the authoring and bandwidth simulation environment.
But doesn't work in the real life through the HTML page.
Code:
ThumbLoaderListener = new Object();
ThumbLoaderListener.progress = function(eventObject) {
Progress_bar.setProgress(ThumbLoader.percentLoaded, 100);
};
ThumbLoader.addEventListener("progress", ThumbLoaderListener);
Then I tried the following which also didn't work.
Code:
Progress_bar.mode="polled";
Progress_bar.source=ThumbLoader;
Then came across the issue between the Loader & Progress Bar components here http://www.macromedia.com/cfusion/kn...fm?id=tn_19442
Code:
Flash TechNoteProgress Bar does not sync with Loader Component in a movie clip
Issue
When a ProgressBar component and a Loader component are in the same movie clip, and the ProgressBar component links to the Loader component using a relative link, the ProgressBar component will not show the correct percentage corresponding to the Loader component's status.
Reason
If you simply add the name of the Loader—for example, myLoader—in the ProgressBar Component Inspector, the component's source actually points to _parent.myLoader. The ProgressBar is therefore unable to locate the Loader component.
Solution
When you use the Component Inspector to set the source, the source is defined to use a relative path. However, since an absolute path is required, make sure to specify one when using the Component Inspector to set the source. For example, if linking to the same Loader component (myLoader), and both components are in a movie clip named mcName, set the source to mcName.myLoader.
Last updated: July 26, 2004
The solution according to Macromedia is
Code:
Progress_bar.source=MovieClipInstance.ThumbLoader;
Now I have three movieclips (Thumb1_mc, Thumb2_mc, Thumb3_mc) and the Loader & Progress are inside those three move clips. How to set the Progress_bar.source=???
I am really confused.
It seems the progress event of the loader doesn't work at all.
Somebody please give me a workaround or some solution.
I did lot of searching in the net for this issue and found no solution. Please help me.
Kannan.
View Replies !
View Related
Progress Bar/Loader Component Question.
I've read the tutorial on UI Components here on UltraShock and you guys did a great Job on it. However i don't understand something: What's the point of having a progressbar/loader when it has to load a differnt swf file? so i thought well i could just use the progressbar and when it's finished it would goto a different frame, but from my reading the eventlistener doesn't seem to work in mx 2004 for the progress bar so how would i make the progress bar load the swf file and then go to frame 2?
View Replies !
View Related
Loader.close() Method Won't Stop A Progress
Hello,
I'm running into some problems using the close() method.
I'm trying to build a class that checks a resource size before loading it.
it's very simple: I use the Loader class to load the resource, listens to the first progress event and immediately closes the connection with the Loader.close() method.
However, the close() doesn't seem to stop the Loader after the first progress event dispatched.
here is a quick copy & paste frame code just to demonstrate my point:
Code:
Code:
import flash.display.Loader;
import flash.events.ProgressEvent;
import flash.net.URLRequest;
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, printProgress);
loader.load(new URLRequest("big.jpg"));
function printProgress(evtProgress:ProgressEvent):void
{
trace("progress");
loader.close();
trace(evtProgress.bytesLoaded);
}
The ProgressEvent is thrown until the big.jpg loading is complete.
How could I stop it just after the first progress event ?
Thanks a lot,
Me.
View Replies !
View Related
How To Detect The Content Of A Loader?
I would like to create a text field for the user to input the img URL which will be put into the contentPath of a Loader.
I have a question that how to detect when the user entered a invalid URL and the loader will load the default image??
Thanks so much
View Replies !
View Related
ProgressEvent AS3
In AS2, i can import a MovieClip from library using the attachMovie, and in this MovieClip i can use the MovieClipLoader Class to load a image and show the progress (using a MovieClip that is inside the MovieClip imported). Example:
var mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
var mc:MovieClip = _root.attachMovie("myMc", "myMc"+i, _root.getNextHighestDepth());
mcl.loadClip("image"+i, mc.holder);
mvl.addListener(mclListener);
mclListener.onLoadProgress = function(target_mc, loadedBytes, totalBytes) {
target_mc._parent.bar._yscale = loadedBytes/totalBytes*100;
}
Where, holder is a MovieClip that is in the MovieClip myMc and bar is a MovieClip that is in the MovieClip myMc. With this, for each MovieClip that is imported i can show the load progress.
Now in AS3 i am not obtaining the progress from this images, i even can't say to Flash where is the target to scale. I am using this:
var loader:Loader = new Loader();
var mc:MovieClip = new myMc();
addChild(mc);
mc.holder.addChild(loader);
loader.load(new URLRequest("image"+i));
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
function loadProgress(evt:ProgressEvent) {
var loaded:Number = evt.bytesLoaded;
var total:Number = evt.bytesTotal;
mc.bar.width = loaded/total;
}
The Flash don´t show the progress from the image and apears errors on the Output panel. Somebody already passed for this problem of migration and have a soluction?
Sorry for my english.
Thanks
View Replies !
View Related
ProgressEvent Errror
I have this code:
Code:
function loadMyGame():void
{
// Load game
gameLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
gameLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, myGameLoaded);
var url:String = hostName + LoadGame;
gameLoader.load(new URLRequest(LoadGame));
}
function onProgress(e:ProgressEvent)
{
//myText.appendText("bytesLoaded: " + event.bytesLoaded);
//myText.appendText("bytesTotal: " + event.bytesTotal);
//var percent:Number = event.bytesLoaded / event.bytesTotal;
//percent *= -1;
//loader.textFill.fillerUp.y = percent;
}
But I'm getting a runtime error in the onProgress function that says can't access properties/methods of null object reference, so for some reason the e variable is not getting filled in properely or something. The game still loads and runs fine, it's just that event doesnt fire properly.
Anyone know what is going on?
View Replies !
View Related
ProgressEvent Question
I use ProgressEvent to show file loading progress,like follows:
Code:
package
{
import flash.net.*;
import flash.events.*;
import flash.text.*;
import flash.display.Sprite;
public class Test extends Sprite
{
private var _output:TextField;
public function Test(){
initializeOutput();
loadData();
}
private function initializeOutput():void{
_output=new TextField();
_output.width=stage.stageWidth;
_output.height=stage.stageHeight;
addChild(_output);
}
private function loadData():void{
var loader:URLLoader=new URLLoader();
loader.addEventListener(ProgressEvent.PROGRESS,handleProgress);
loader.load(new URLRequest("example.html")); //example.html is a very big file,such as 200M
}
private function handleProgress(event:ProgressEvent):void{
var percent:Number=Math.round(event.bytesLoaded/event.bytesTotal*100);
_output.text="Loaded: "+event.bytesLoaded+"
"
+"Totla: "+event.bytesTotal+"
"
+"Percent: "+percent;
}
}
}
When run above code,I find mouse type is running status,because load file "example.html" is a very big file about 200M,after about 6 second,screen appears loaded percent,but the percent has equals 100%,I want to show percent from 0% to 100%,why I can't get the process of percent from 0% to 100%? How to correct my above code to get the process of percent from 0% to 100%?
Thanks
View Replies !
View Related
ProgressEvent.url Non-existent?
I have multiple downloads calling eProgress.
I guess ProgressEvent does not have the url property Event has?
How can I access the filename beign downloaded.
ActionScript Code:
function eProgress(e:ProgressEvent):void
{
trace(e.target.url); // Null
}
View Replies !
View Related
Need Netstream ProgressEvent
I'm in a situation where I need a pre-loader to load a video entirely into a swf, then play it. Problem is I don't know how to display the exact progress of the video (which I'll need to display an accurate pre-loader), I only know when the loading starts with the NET_STATUS event listener. I would like to attach a progress event to the NetStream somehow, anybody know how to do this? Tried googling it, but google isn't my friend :( Thank Jeebis the forum is back up!
Oh, I tried using:
netStream.addEventListener(ProgressEvent.PROGRESS, videoProgress);
Didn't work. Any help?
View Replies !
View Related
Problem With ProgressEvent
Hello.
I am migrating my aplications from ActionScript 2 to ActionScript3 and i have a problem with the LoadProgress. I create a gallery using XML, this gallery show a small image and when i click in this small image the larger image show.
The small images are loaded in a MovieClip that is imported from the Library. So, for each small image i import a MovieClip on the stage. The problem is show the load progress from this small images.
In ActionScrip i use something like this:
ActionScript Code:
var loader:MovieClipLoader = new MovieClipLoader();var listener:Object = new Object();for (var i=0; i<5; i++) { var mc:MovieClip = holder.attachMovie("id", "id"+i, _root.getNextHighestDepth()); mc._x = i*mc._width+i*10; loader.loadClip("image"+i, holder.mcTarget);}listener.onLoadProgress = function (targetMc:MovieClip, btLoaded:Number, btTotal:Number) { var progress:Number = Math.round(btLoaded/btTotal*100); targetMc._parent.preloader._xscale = progress;}loader.addListener(listener);
The holder is a MovieClip that i use to import the MovieClips from the library, the preloader is the MovieClip to show the load progress. With this i can show the load progress from the small image.
But, with the ActionScript 3 i cant do this, i try to use some like this:
ActionScript Code:
var loader:Loader = new Loader();for (var i=0; i<5; i++) { var mc:MovieClip = new item(); holder.addChild(mc); mc.x = i*mc.width+i*10; loader.load(new URLRequest("image"+i)); mc.mcTarget.addChild(); loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);}function loadProgress(event:ProgressEvent):void { var progress:Number = Math.round((event.bytesLoaded/event.bytesTotal)*100); event.target.parent.preloader.scaleX = progress;}
But, the Flash return a error and in can discover how fix this problem, how the load progress from that small images.
Some somebody knows how to do this? I think that i need create some Class for this MovieClip that is imported from a library.
Thanks
View Replies !
View Related
Problem With ProgressEvent
I have this code:
Code:
function loadMyGame():void
{
// Load game
gameLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
gameLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, myGameLoaded);
var url:String = hostName + LoadGame;
gameLoader.load(new URLRequest(LoadGame));
}
function onProgress(e:ProgressEvent)
{
//myText.appendText("bytesLoaded: " + event.bytesLoaded);
//myText.appendText("bytesTotal: " + event.bytesTotal);
//var percent:Number = event.bytesLoaded / event.bytesTotal;
//percent *= -1;
//loader.textFill.fillerUp.y = percent;
}
But I'm getting a runtime error in the onProgress function that says can't access properties/methods of null object reference, so for some reason the e variable is not getting filled in properely or something. The game still loads and runs fine, it's just that event doesnt fire properly.
Anyone know what is going on?
View Replies !
View Related
Use Of ProgressEvent For Upload And FileReference
Hi
I have a question concerning the use of ProgressEvent and the upload of files that have a size of 3 or 4 mo ( = files that can't be uploaded in 1 second or instantly)
I call my function progressUploadHandler on the event ProgressEvent.PROGRESS
Code:
function progressUploadHandler(event:ProgressEvent)
{
var pourcentage = Math.ceil((event.bytesLoaded*100)/event.bytesTotal);
trace(pourcentage);
}
What I don't understand is how is it possible that the variable "pourcentage" reach the value of 100 in 1 or 2 seconds (which would mean the file is 100% uploaded) while the file is not 100% uploaded on the server and still needs a few seconds to be entirely sent.
1. So, what would bytesLoaded really refers to if I the variable "pourcentage" is equal to 100% whereas it is not entirely sent on the server?
2. What property or the event should I call to have the correct value of the data that are really uploaded when I call my function on ProgressEvent?
Many thanks for your help
View Replies !
View Related
EnterFrame And ProgressEvent Does Not Work In IE
Hi All,
I have got two swf's one preloader and one main movie. The y both work perfect, in flash and in IE. The problem is that in the main movie there are some pictures being loaded and for that I also have a simple preloader. It works fine in Flash but when I publish it on the internet it doesn't seem to load anything ( loader percent stay's 0 ). I have tried the preloader with ProgessEvent and now changed it to EnterFrame. I really have no clue where to look for the mailfunction.
Below a snippet of the code for the preloader.
Thank for any help.
Silvio....
public function ScrapBook( w:Number, h:Number, image:String ):void
{
// initiallize size of scrapbook
scrWidth = w;
scrHeight = h;
loaderTopPage= new Loader();
loaderTopPage.contentLoaderInfo.addEventListener( Event.COMPLETE,
addTopPage );
loaderTopPage.contentLoaderInfo.addEventListener( IOErrorEvent.IO_ERROR, loadError );
loaderTopPage.contentLoaderInfo.addEventListener( SecurityErrorEvent.SECURITY_ERROR,
securityError );
loaderTopPage.addEventListener(Event.ENTER_FRAME,
progressListener);
loaderTopPage.load( new URLRequest( image ) );
}
private function addTopPage( e:Event ):void
{
e.target.content.width = scrWidth;
e.target.content.height = scrHeight;
bitmapDataTop = new BitmapData( scrWidth,scrHeight );
bitmapDataTop.draw( loaderTopPage );
bitmapTop = new Bitmap( bitmapDataTop );
if ( loadedPercent >= 100 )
{
addChild( bitmapTop );
}
}
private function progressListener( e:Event ):void
{
totalBytes = e.target.contentLoaderInfo.bytesTotal;
var loadedTotal:Number = e.target.contentLoaderInfo.bytesLoaded;
loadedPercent = Math.round( loadedTotal / totalBytes * 100);
txtField.width = 200;
txtField.visible = true;
txtField.text = "bezig met laden nog " + loadedPercent + " %";
txtField.x = 50;
txtField.y = 50;
addChild( txtField );
if ( loadedPercent >= 100 )
{
removeChild( txtField );
}
}
private function loadError( e:IOErrorEvent ):void
{
trace( "fout met Laded" );
}
private function securityError( e:SecurityErrorEvent ):void
{
txtField.text = "security error"
}
View Replies !
View Related
|