ActionScript 3.0 :: LoaderInfo Of ContentLoaderInfo?
Jul 7, 2011
As a part of a class I have been asked to place a preloader in front of my projects. I can't believe how tough this is. I get the best results when I use an URLRequest, but I want to understand the timeline.When I put a working preloader in front of my movie it doesn't start "ticking" until some middle point like 20%, or 70% depending on the file size of the movie. When I trace the bytes.Loaded it doesn't start counting until 700K or so.I have looked at several different preloaders and none seem to work as well as the tutorial. Can someone direct me to an "easy to understand" source that explains the loaderInfo / contentLoaderInfo class?
View 3 Replies
Similar Posts:
Nov 4, 2009
I am writing a method in a FileIO class called returnBMP()
The idea is: I want to pass it a file name, and I want it to return a Bitmap. ( not a loader )
The problem is that the only way I know how to pull a bitmap out of a loader is by creating an eventListener on the contentLoaderInfo for COMPLETE.
That just doesn't work in a return function. the return is executed before the bitmap is loaded. I get a null..
here's my code:
ActionScript Code:
public function returnBMP(img){
var bmp:Bitmap;
var loader = new Loader();
[Code]....
View 4 Replies
Jan 19, 2010
Here's the code in question:
[Code]...
When I preview the file I get the following errors: Quote: 1119: Access of possibly undefined property bytesLoaded through a reference with static type flash.display:Loader. 1119: Access of possibly undefined property bytesTotal through a reference with static type flash.display:Loader. If I comment out the onProgress function and it's associated event listener the file runs fine. I believe both event listeners call the flash.events
View 3 Replies
Oct 20, 2007
How do I access the object of an event? Can't quite figure it out. This is what's happening.
object.contentLoaderInfo(Event.INIT, someFunction);
private function someFunction(e:Event):void{
trace(e.target);
}
Output = [object LoaderInfo]
I want to access the parent of the object, but I'm hitting a dead end.
View 3 Replies
Mar 6, 2009
I am loading images dynamically from the web into my swf. I use a loader class and add an Event Listener to the loader so it will add the image to the stage when done.
Code:
for (var i:int = 0; i < number; i++){
var poodleLoader = new Loader();
poodleLoader.load(new URLRequest(urls[i]));
poodleLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, showPoodle);
}
But what I do not manage to do is referring from the Event.COMPLETE-event to the loader object in my showPoodle-function. How do I refer to it? I was thinking addChild(e.target.parent.data) but it tells me the contentLoaderInfo has no parent?
View 2 Replies
Jul 4, 2009
I have a preloader function that uses contentLoaderInfo to load swfs ont the stage. It works fine in simulated download in the Flash Player. When I run it on my host the swf file finishes downloading before the preloader appears to run. I use the word appears because I only sometimes spot a glimpse of a graphic that indicates the loading process.
Are there known discerpancies between host and Flash Player realities?
Are there any subtlties with using with contentLoaderInfo?
View 8 Replies
Apr 12, 2011
I wanna pass a value through an image loading event, and my simple aproach was setting a name into Loader object. But I'm not had success in that.
function loadAll()
{
for(var i:uint = 0; i < len; i++)
[code].....
View 2 Replies
Oct 5, 2010
I basically have rectangles which I want to replace with images I load through XML references. The rectangle instance names are from image0-imageNumberWhatever. I've got everything working, the only thing I can't seem to do is once each image is loaded, it fades in instead of randomly appearing. Below is my code:
Code: Select allimport flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
[code].....
View 2 Replies
Nov 10, 2009
I've one loader which load a png file. I used contentLoaderInfo to intercept COMPLETE event like this:
loader.contentLoaderInfo.addEventListener(Event.Complete, handler); The problem is that at the complete event I want to push this object into an array, like this:
function handler(e:event){
var array:Array = new Array();
array.push(e.target);
}
E.target is the reference to the contentInfoloader, while I need the reference to the loader itself. How can i resolve this issue?
View 3 Replies
Jan 13, 2010
I have made a Flash app in which there is an class called "MyGame.Person" which has multiple subclasses "MyGame.PoliceMan", "MyGame.FireMan", "MyGame.Doctor" etc. "MyGame.Person" is defined in the main .fla file, but the other classes are each defined in separate .fla files. I have split each into its own .swf file so that I can extend the game without having to reissue the main .swf file.I then use a Loader to download each .swf file and call
var assetClass:Class = myLoader.contentLoaderInfo.applicationDomain.getDefinition(assetClass Name) as Class;
to extract the class from the downloaded swf file. So if assetClassName is
[code].....
View 2 Replies
Jul 17, 2009
I've got a system that loads in little avatar images. When the avatar is loaded in I resize it to 24x24.
Here's some ActionScript Code:
var urlReq:URLRequest = new URLRequest( String(playerInfo.vector.scalar.(@id == "AvatarURL")) );
var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, resizeAvatar);
ldr.load(urlReq);
avatar.addChild(ldr);
container.addChild(avatar);
Here is the resizeAvatar function...
ActionScript Code:
// Resizes the avatar to fit correctly
public function resizeAvatar( e:Event ):void {
e.target.content.width = 24;
e.target.content.height = 24;
e.target.content.smoothing = true;
}
Now I'm using the e.target.content item because as far as I can see that's the only way to get at a way or resizing the image dynamically (using an Array isn't an option). Here's the funny part, the above code works perfectly in the Flash IDE but when on a live site that Event.COMPLETE is not calling!? The image is loading in but it never gets resized.
View 4 Replies
Apr 13, 2009
I've created a preloader using the following script:
mySWF.contentLoaderInfo.addEventListener(ProgressE vent.PROGRESS, loop);
mySWF.contentLoaderInfo.addEventListener(Event.COM PLETE, done);
Works, but even if the content has been previously downloaded there is still a quick flicker of frame1 of the preloader...is there a way to avoid this (in AS2 you could check, if loaded)? Is there a way to arrange...maybe using an if statement...to avoid the flicker? Basically if the file is available locally bypass frame1 of the preloader and go to frame2?
View 1 Replies
Jan 14, 2010
I'm building a 10 channel mixer/remixer in Flash. Users can select a "song" to load from an xml driven combo box at the top of the application. In the document class, there is a function that takes the selected item from the combo box and loads in an external swf, which just serves as a library for the 10 sounds of a particular song. I then have to extract each of these sounds by their class names ("Track1", "Track2", "Track3", etc...) and send them off to their respective "MixerChannel" objects. As you can see, the following code block in the "initHandler" is pretty long and redundant. Is there any other way/shortcuts I can use to reduce the code a bit?
[Code]....
View 4 Replies
May 26, 2010
I am trying to make a Loader variable with contentLoaderInfo as a new instance and for every object in the array like this:
[Code]....
so for some reason the previews object in the display list gets bumped out with the last object in the array.
View 1 Replies
Aug 24, 2011
I am having an issue with a class I'm working on. I currently load an image as a bitmap and store its data into regState:BitmapData so that I may make new instances of that image later on. When I test if I can use the loaded data at a later time with my newBitmapIntance() function, it says that regState is null. I'm lost as to why this is the case, since it works flawlessly to create an instance of itself in my loadContent() function.
Class so far For reference:
package {
import flash.display.MovieClip;
[code].....
View 1 Replies
May 7, 2009
I'm trying to figure out how contentLoaderInfo works; I'm trying to display 5 images on stage and place them horizontally based on their individual widths. Everything works fine except inside displayImage i remains at 5. Each width traces out correctly, but i stays at 5. What is it about contentLoaderInfo that I'm not understanding?
[Code]...
View 4 Replies
Aug 26, 2009
i have a swf and i send parameter to this from html. when i load this swf directly to the html page, i can take paramters by using 'this.root.loaderInfo'However, i load this swf into another swf and i load second swf to the html. by this way, i cant take paramters using 'this.root.loaderInfo'. what should i do for this? what is the root and parent relationship between swfs that one within the other one.
View 1 Replies
Nov 22, 2011
I'm developing a flash file that that will be uploaded to dozens of websites which I have no control over. I found out that one of them seems to be gzipping the swf, which is causing loaderInfo.bytesTotal to be zero. This screws up the loading animation. I tried a workaround of just testing if bytesTotal is zero, if so simply proceed. That doesn't work because, as expected, not all the necessary data has loaded yet. Alternatively I can put a timed delay of whatever the expected load time is, and hope that it covers all the bases.
Does anyone have any other suggestions? Ideally there's an alternative way to define bytesTotal, but I haven't found one. FYI this is somewhat related to this question: Why loaderInfo.bytesTotal is Zero But I can't do the htaccess suggestion because I don't have control over the other websites, some of which may be on windows servers anyway.
View 2 Replies
Oct 17, 2007
I'm loading an image with Loader class, adding a listener to its LoaderInfo object like this:
ActionScript Code:
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
var req:URLRequest = new URLRequest("myUrl.jpg");
loader.load(req);
Then of course I have a function ioErrorHandler. How can I get the url within that error handler?
The IOErrorEvent doesn't have something like a url property, nore does the LoaderInfo has one. Well, I just though of getting my Loader object back within the error handler like this:
ActionScript Code:
function ioErrorHandler(event:Event){
trace(event.target.loader);
}
But well... I get runtime error #2099. The Loader object is not available in ioErrorEvent. Do I really need to parse the url from IOErrorEvent.message?
View 9 Replies
Jun 28, 2008
how to use LoaderInfo.getLoaderInfoByDefinition(obj)??? Docs say it wants a "SWF File Object"... I tried feeding it a loaded movieclip. hoping to get the clips loaderInfo, but it simply returned the loaderInfo for the stage, not the loaded clip...
View 2 Replies
Aug 11, 2009
I need to get the density and units from loaded images, both jpg and png. I am able to get the data, but the bytes do not seem to be where they should, according to [URL]..rchange_Format units, xDensity and yDensity should be proceed one another, but I get an unknown value between units and xDensity. Am I reading the JFIF specs wrong or am I doing somthing wrong with the byteArray? Same with pHYs data in pngs, I can get the data but it's not where I expect it according to
[Code]...
Edit: Forgot to add, I am reading the first 100 bytes of the loaderInfo, picked this number arbitrarily. Any suggestions on a safe length, long enough to ensure I can retrieve the metadata but short enough to keep it quick.
View 3 Replies
Oct 7, 2010
This is my case
1: I have two swf : a.swf n b.swf
2: I can't do any coding on a.swf but I can code on b.swf
3: b.swf loads a.swf
4: a.swf takes some params from html
5: Since b.swf now loads a.swf,how can I set loaderinfo params of a.swf from b.swf?
So is there any way I can set loaderinfo params from loading swf to the loaded swf.
View 3 Replies
Nov 12, 2009
I am using LoaderInfo params in my Flash movie. Is it possible to specify sample flashvars in Flash CS4 during design time for debugging???
View 1 Replies
Jun 7, 2011
I have built a music community website, obviously members can sign up for an account, and upload mp3 files to their accounts.Once registration is complete, the php script creates a folder in the members directory on my server with their unique id, then when they go and upload an mp3, it uploads it to their folder and automatically creates a playlist.xml file for the song(s) I have a prebuilt flash mp3 player that I got from developphp.com, his as3 code calls for a static directory for the audio and xml, now since the flash player will live in the root, and the xml and audio will live in the members/$id folders, I am told to use flashvars and loaderinfo.parameters to do what I need, and that is to load the xml and mp3 files into the player for the profile that is being viewed at that moment, so lets look at what I've put into the html object and embed.
lets use profile #7
<param name="movie" value="flplayer.swf?<?php print"$id/playlist.xml" ?>">
<embed src="flplayer.swf?<?php print "$id/playlist.xml" ?>"> (please tell me if I have done this incorrectly)
now if we go to the profile.php?id=7 page, thius is what the page source looks like:
<param name="movie" value="flplayer.swf?7/playlist.xml">
<embed src="flplayer.swf?7/playlist.xml>">
now here is where I am stuck, as I said the flash mp3 player urlLoader and URLRequest, and I have been searching for days to figure out what I am supposed to do to get the player to pick up on the flash vars, here is the top part of the as3 code where it calls for the mp3 and the xml.
stop();
var myFormat:TextFormat = new TextFormat();
myFormat.color = "0xFFFFFF";
list.setRendererStyle("textFormat", myFormat);
[code]....
View 15 Replies
Mar 27, 2010
I have a problem with Flex module. I want to access url variables by this.loaderInfo.url, i call a function in createionComplete handler of module and sometimes it works and sometimes it doesn't. (Can't access... null). Any suggestions?
This function is called in creationComplete handler of module. And although it throws error window, the alert with url shows and contains url of module.
private function checkModuleUrl():void
{
var url:String = this.loaderInfo.url;
Alert.show(url);
}
View 5 Replies
Dec 4, 2011
I am using flashvars to get some info. When im using LoaderInfo(this.root.loaderInfo).parameters from the main fla frame it works fine but how can I use it from withing a class? Something like this -
[Code]...
I'm getting this error message: Access of possibly undefined property root through a reference with static type. Hope someone could guide me how to overcome this.
View 1 Replies
Nov 25, 2009
I would like to find documentation on the order of events for my_loader.contentLoaderInfo;
specifically: does init ALWAYS fire before complete?
View 5 Replies
Feb 25, 2008
i have a file named: 394354.html. In it is the following code:
codebase="http://download.macromedia.com/pub/s...ersion=9,0,0,0" width="900" height="900" id="LoaderExample" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
[Code]...
That is part of the source in the LoaderExample.swf. And all I get is a "Parameter text must be non-null" error. I've alternatively tried the FlashVars method using additional <param> and <object> tags but i get the same error. What is going on with Actionscript 3? is this a bug? What am I doing wrong? Do the 5 or 6 tutorials i've read leave some important detail out ?
View 9 Replies
Jun 22, 2009
I have a class that loads a handful of external swfs, and a preloader class to handle them all as a single object.I was having some strange problems with the loading process and tried tracing the urls to see which file was bugging. For my surprise, almost all loaderInfo objects reported theirs url as null.With a bit of testing I came to the conclusion that they only report some url when the file is almost completely loaded. The docs say something about "possibly wrong urls" before progress events, but that would be in cases where redirect happen, and everything here is local with simulate download option. Also, "event.target.url" inside the very progress event handler reports null unless the target's loading is almost done. Unfortunately I don't have any piece of code with less than a hundred lines to show. But is there any undocumented behavior, known bug or common coding error that generates such situation?
View 1 Replies
Oct 7, 2010
This is my case1: I have two swf : a.swf n b.swf2: I can't do any coding on a.swf but I can code on b.swf3: b.swf loads a.swf4: a.swf takes some params from html 5: Since b.swf now loads a.swf,how can I set loaderinfo params of a.swf from b.swf?So is there any way I can set loaderinfo params from loading swf to the loaded swf.
View 6 Replies