ActionScript 3.0 :: Get URL From LoaderInfo IOErrorEvent
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
Similar Posts:
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
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
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
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
Apr 12, 2011
I want to get some flashVars parameters, but have a hard time getting them into any variable.
When using the following code :
[Code]....
the values are shown inside the SWF as expected. However, when adding a trace in the for loop, nothing is there.
Why is this, and how should I retrieve the variables?
View 6 Replies
Nov 9, 2011
I am which requires few things like;
1. swf should play if client open it at his end (this will be detected by checking a text file which has variable on the local drive say "C") swf should preload if finds flashvars from HTML file on server by user 3. if both of the above conditions dosent work then swf should not play
I have succeeded some what in this. if i run the file without preloader it work fine. but when i add preloader to it something goes wrong.
[Code]...
View 5 Replies
Oct 17, 2011
Flash gives access to query-string parameters via calling loaderInfo.parameters() method.And I couldn't delete the field on the object. IS it possible to delete some fields in the object? how can I do this?
View 1 Replies
Dec 5, 2007
I don't know if this is even possible, or if I'm going the right way about this.Here's what I've got:
ActionScript Code:
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageProgressHandler);
function imageProgressHandler(event:ProgressEvent):void {
[code]......
View 3 Replies
Jan 7, 2011
The class that I am struggling with is not the Document Class. I've had great success grabbing variables using LoaderInfo there when building the page from the start. LoaderInfo works great there, I think I am struggling to understand how to use it with the nested classes.This class, SetBookMark.as, is imported into another class that controls button methods. When the user clicks the exit button, its supposed to set the cookies and close the browser window. I've done a lot of error checking and JavaScript alerts to ensure everything is functioning properly and my classes are pulled in correctly. The code I posted below from the navigation class I have built is just the important part showing that I have called the class, added it to the DisplayList. Everything works great other than where it fails to grab the closeTheWindow variable and what its set to.This is the variable in JavaScript that I am trying to grab using FlashVars and LoaderInfo.
Code:
document.movie.FlashVars = "closeTheWindow=true";
Snippet from navigation class that I pulled together
[code]....
View 2 Replies
Jun 3, 2009
when I try loaderInfo.content it traces [object MainTimeline] but should trace the external image
View 1 Replies
Aug 31, 2009
I have something like the following code:
Code:
var req:URLRequest = new URLRequest('child.swf');
var vars:URLVariables = new URLVariables();
vars.foo = 'bar';
[Code]....
but when I change URLRequestMethod.GET to URLRequestMethod.POST, I'm unable to. why, and if there's a workaround?
View 2 Replies
Nov 30, 2010
how to access loaderInfo and also call functions immediately in a class.My game is 99% there, but for this problem, whenever I run the code in the order below, I get:Error #1120: Access of undefined property root.Error #1009: Cannot access a property or method of a null object reference showMessage();[code]Is there a way I can get the loaderInfo parameters immediately, and call showMessage() if previewcard is true?
View 5 Replies
May 10, 2010
I'm using this.loaderInfo.addEventListener(Event.COMPLETE to call a function when the flashVars are available as many tutorials/examples suggest. Is it correct to use it in the root of the main swf? The event is often not firing in firefox.
Here's the test code. Am I doing something wrong?
Code:
import flash.display.Loader;
import flash.events.Event;
var flashVars=new Object();
[code]....
View 2 Replies
Jul 29, 2010
I continue, I must say I've searched on forum and on google and all the different kind of code didn't work On my actionscript panel, I have this:
import com.greensock.*;import flash.net.URLRequest;
import flash.display.Stage;import flash.display.LoaderInfo;
var sujet_no:String = LoaderInfo(this.root.loaderInfo).parameters["sujet_no"];var timer:String = LoaderInfo(this.root.loaderInfo).parameters["timer"];var back_url:String =
[Code]...
View 7 Replies
Apr 15, 2012
So im trying to gain access to flash vars but i kept getting this error: Line 27 1180: Call to a possibly undefined method LoaderInfo.
I have tried putting the below code in and outside of my class but it seems from what i have gathered that it thinks 'LoaderInfo' is another function which it is not.
[Code]...
View 3 Replies
Apr 30, 2010
I've coded this small snippet to show what I'm not understanding:
[Code]...
Shouldn't I be able to read loaderInfo inside the creationComplete handler? I'm trying to pass a string from the html to my flash component, that's why I have to get loaderInfo working.
View 1 Replies
Mar 1, 2012
I have preloader code in my main FLA, and I load the corresponding preloader (a small file) externally. When I detect that the file is fully loaded, I need to add the listener to the content that I want to "preload".[code]If I use it this way, the loaderInfo listener does not work, but if I add the listener ouside of the handler function, it does.The problem is, I need it to work from within the complete handler, because obviously, the preloaded can show the % completed only after it's loaded...
View 1 Replies
Jun 4, 2009
When I try loaderInfo.content it traces [object MainTimeline] but should trace the external image.tracing loaderInfo.bytesLoaded does not trace the image progress. It should
Code:
var objAimg:Array = new Array();
var ldrA:Array = new Array();
var url:String;
var urlReq:URLRequest;
[code]....
View 2 Replies
May 4, 2010
I've createa simple flash banner (FL10, CS4) that is used stored in multiple locations on a server, which is sent a relative path to an XML file via FlashVars. relative path images are then loaded from this xml file.the base class for the banner is.Thins all works fine locally and in IE but in Firefox it fails about half the time to trigger the loaderinfo Event.COMPLETE call.(essence of the Base class below:)
public class Banner extends MovieClip {
public function Banner() [code]....
View 3 Replies