Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

SWFLoader: 'Icon' and 'FLVPlayback' properties?

Recommended Posts

I have an AIR for iOS application where I'm downloading remote swfs and then playing them. When I was using a generic loader this worked exactly as intended, but I wanted to switch to LoaderMax. When I use LoaderMax SWFLoader to download the swfs, it works fine when I test in Debug mode on the desktop. However when I run the app on the iPhone, I get these errors:



ReferenceError: Error #1065: Variable Icon is not defined.
ReferenceError: Error #1065: Variable FLVPlayback is not defined.



I've searched the documentation and code files for SWFLoader and its base classes, but I can't find any reference to these properties. However, when I'm creating a new SWFLoader object and I type "icon" or "FLVPlayback" as properties to pass to the SWFLoader, Flash CS6 turns them blue (implying that they're valid parameters to pass to the constructor).


The code that doesn't work on the device:

   var mySwfLoader:SWFLoader = new SWFLoader(val, {name:key, autoPlay:false, onComplete:completeHandler});


The place where I can see "icon" and "FLVPlayback" turn blue:

   var mySwfLoader:SWFLoader = new SWFLoader(val, {name:key, autoPlay:false,[b] icon:[someVar], FLVPlayback:[someVar][/b], onComplete:completeHandler});



So what I gathered from this is that, for some reason, when running on iOS the app requires that icon and FLVPlayback are defined. But I can't find any documentation on these properties in the LoaderMax classes themselves or online. Can anyone tell me what default properties I can pass to these, or at least give me some documentation on what data types they are/what they're expecting? (I tried passing 'false' to each, hoping maybe they were booleans, but to no avail).


Any assistance whatsoever would be appreciated in this matter. Thanks!

Link to comment
Share on other sites

It sounds like you've got something else in your app that is referencing those (FLVPlayback and Icon). I can assure you that those have nothing to do with LoaderMax.


What Flash Player version are you publishing to? I wonder if maybe you're publishing to an older version that doesn't support FLVPlayback or something. Just a guess.


Not sure if this will help: http://www.kirupa.com/forum/showthread.php?274871-ReferenceError-Error-1065-Variable-is-not-defined


By the way, when CS6 turns something blue, that doesn't mean it's somehow valid in the context you're using it - it simply means that it's a keyword that CS6 recognizes from its own set of classes (NOT LoaderMax or any 3rd party tools).


If you're still having trouble, feel free to post a simple example FLA that clearly demonstrates the issue so that we can publish on our end and see what's happening.

Link to comment
Share on other sites

Hi, thanks for your reply! That's unfortunate to hear, because I'm not using FLVPlayback anywhere in my code and I've never even *heard* of an Icon class. (I tried googling to find out what the Icon class was, but I couldn't find anything.)


When I use a simple URLRequest and Loader instead of LoaderMax, everything works just fine; I get no errors and the video plays properly. So when I saw the words turn blue inside the SWFLoader constructor (after trying that on a whim) I thought I'd found the problem as something I was doing wrong with LoaderMax. Thanks for letting me know that the blue keyword doesn't mean it relates to that LoaderMax function.


And to answer your question, I am building to AIR 3.2 for iOS.


So if it's not a problem with my usage of LoaderMax, I don't know what it is, because like I said before it works fine when I just use the built-in URLRequest and Loader classes.


It took me a little while to reply because I was setting up a sample project to share with you. I made a test project and cleaned things up a bit, and also created a sample .swf because the .swf I want to load belongs to a client and I'm not sure if I can share it. Interestingly enough, I don't get quite the same errors with the sample .swf as I do with the one I was loading earlier. It still crashes as soon as the .swf loads, but I don't get the "Icon" and "FLVPlayback" error messages. It simply crashes with no output whatsoever.


Sample project is attached. At the start of the LoaderTestClean class, you'll see a variable "USE_LOADERMAX_FOR_SWF". When set to true it uses LoaderMax to download my swf; when set to false it uses a generic loader. When not using LoaderMax, it runs fine both on the desktop and on the iPhone. If you tell it to use LoaderMax and then run it in Debug mode on the desktop you'll see that it works fine; but when you build it on a device with LoaderMax it crashes. Any insight or ideas you have on this matter would be very much appreciated. As you can see, the only difference between the code which crashes and does not crash is that I'm using LoaderMax to download the swf when it crashes. Hopefully you can spot what it is that I'm doing wrong!


It won't let me upload the sample with Greensock's libraries included because the zip becomes too large, but if you simply include them inside a "com" folder and then the "greensock" folder, it should all work.


Thanks very much for the speedy reply and your assistance,




Link to comment
Share on other sites

A few questions:

  1. What version of LoaderMax are you using? (I would definitely recommend using the latest)
  2. Do you have the same problem when you try to load a completely different swf? I wonder if there is something specific to this subloading swf that's causing the problem, like if it depends on a particular display list hierarchy.
  3. Does it help if you define a unique LoaderContext, like context:new LoaderContext(true, new ApplicationDomain())?
  4. What happens when you use a regular Loader and then do this:?
    var tempContent:DisplayObject = loader.content;
    var className:String = getQualifiedClassName(tempContent);

    Does it crash? Any errors?

Unfortunately, I don't have a way to push the AIR app onto an iOS device right now to test for myself.

Link to comment
Share on other sites

1. I am using the latest version (downloaded again today just to be sure!)

2. Sort of; when I load a different swf I don't get the "Icon" and "FLVPlayback" error messages, but it still crashes (only on the device, not the desktop). It just crashes without any output.

3. No. It still crashes with the same output on the device.

4. When I run that and trace the className, I get:




Something I meant to say earlier... It does actually download the swf, because I get this output:



[sWF] /staging/AA/Test/samplevid.swf - 1168992 bytes after decompression


But it crashes immediately after that.





Link to comment
Share on other sites



Do you have any other thoughts as to why this might be happening? I've kept playing with it and no matter what swf I use, no matter how simple, it works with a simple loader but fails with LoaderMax.



Link to comment
Share on other sites

A few more questions:

  1. What do you get when you trace(Capabilities.playerType)?
  2. What happens if you call Security.allowDomain(YOUR_FILE_URL)?
  3. Does it stop crashing if you set LoaderMax.defaultAuditSize = false?
  4. Does it stop crashing if you set autoForceGC:false on your SWFLoader? (in the vars parameter)

Link to comment
Share on other sites

Thanks so much for your help; I really, really appreciate it! I love LoaderMax and was using it for images in other projects before now; I would really love to get it working with these remote swfs on iOS.

  1. It prints "Desktop", even on the phone, which seems rather odd... Is it supposed to do that?
  2. I get this error immediately when the program starts, even running it on the desktop:

SecurityError: Error #3207: Application-sandbox content cannot access this feature.
at flash.system::Security$/allowDomain()

When I run it on the device, the error is the same but the "at" is in a slightly different place:

SecurityError: Error #3207: Application-sandbox content cannot access this feature.
at LoaderTestClean/startLoad()


Am I using this code snippet incorrectly? Before I begin loading the swf, I have


3. Still crashes.

4. Still crashes.


Also I tried ideas 3 and 4 together, just to see what would happen, and it still crashes...


Thanks again, so much, for troubleshooting this with me. Would really love to be able to use LoaderMax! It's so much simpler and cleaner that just a bunch of regular loaders....



Link to comment
Share on other sites

A few more ideas:

  1. Do other loader types work fine? Is it only SWFLoaders that cause the crash?
  2. Did you try all my suggestions with a different swf (not samplevid.swf or any swf that has a video in it?) I wonder if it has something to do with your child swf containing a NetStream or some other code that's trying to run.
  3. Are you doing anything else besides just loading during these tests? Are you doing a dispose() or unload() or cancel() or getClass()?
  4. Does it help if you set autoPlay:true?

Link to comment
Share on other sites

  1. Yep, the ImageLoader works great (tested it with images from the same place on the server as that samplevid.swf).
  2. The Security.allowDomain(FILE_PATH) still crashes the program even on the desktop, so I removed that after putting all your suggestions back in. With all your other suggestions included, though, and with a swf that contained nothing but an image imported to the stage, it still crashed when I loaded it on the device with LoaderMax (and still works fine when I use a regular loader).
  3. No, I'm not doing any of those things that you mentioned. I am loading both the swf and an external image. In the complete handler, I have this code:

swfIsLoaded = true;
myMC = e.target.content as MovieClip;
myMC.scaleX = 2;
myMC.scaleY = 2;
myMC.x = 55;


And then on frame constructed, I check if the swf and image have both downloaded. If so, I call myMC.play(). I do nothing else.


4. No; same result.

Link to comment
Share on other sites

Very interesting.


1) What happens if you do this in your NON-LOADERMAX version (just using a normal Loader) after it loads:

try {
var mc:DisplayObject = YOUR_LOADER.content;
} catch (error:Error) {
trace("ERROR! "+error.message);	   	
if (YOUR_LOADER.content is AVM1Movie) {
trace("old swf");

Obviously replace "YOUR_LOADER" with your Loader instance. Don't forget to import flash.display.AVM1Movie too. Any errors?


2) What happens if you set integrateProgress:false and suppressInitReparentEvents:true?


3) What happens if you use the attached version of SWFLoader? (I commented out several sections just to try to isolate the issue)


Link to comment
Share on other sites

  1. I assumed this would work the same on the desktop as well as the device, so I only tried it on the desktop. It was fine, no error or trace statement. I even added an else to that if:

if (e.target.content is AVM1Movie) {
 trace("old swf");
 trace("All ok");


And it prints "All ok".


2. Still crashes.


3. BRILLIANT!!! Perfect, that worked wonderfully! It downloads and plays just fine, now. Thank you so much for all your help; you have my eternal gratitude. You have no idea how happy I am that this is working!


Wow, okay, so excited. :) Can I simply continue using your modified version of SWFLoader, or will that cause problems down the road? Because it's working wonderfully for me right now :)


Thanks again, so very much!!

Link to comment
Share on other sites

I'm glad that SWFLoader is working, but I removed some functionality to try to isolate the issue, so I'd still like to hone in a bit more. Would you try both of the attached files and see which one works for you?



Link to comment
Share on other sites

Certainly! :) The "with RSL" is the one that works for me :) Does that help you know what's wrong?



Link to comment
Share on other sites

Nope, doesn't crash. That one works just fine :)


Does it matter which version I use in my project, out of the test SWFLoader versions that didn't crash?

Link to comment
Share on other sites

Very interesting. All signs point to the issue being this (please try it with your non-LoaderMax version):


//run as soon as the Loader's INIT event is dispatched:
var loader:Loader = YOUR_LOADER;
if (loader.content is MovieClip) {
   var mc:MovieClip = loader.content as MovieClip;
   var st:SoundTransform = mc.soundTransform;
   st.volume = 0; //just make sure you can't hear any sounds as it's loading in the background.
   mc.soundTransform = st;


Does that crash your Loader-only version?

Link to comment
Share on other sites

I tried putting that code snippet into an "onLoaderInit" function, and attaching the event like this:


mLoader.addEventListener(Event.INIT, onLoaderInit);


But the function is never called. I'm guessing that's not what you meant by


//run as soon as the Loader's INIT event is dispatched:


And that I'm not testing this properly. Let me know what to do so I can test this for you?

Link to comment
Share on other sites

It sounds like the problem is that you added the listener directly to the Loader instead of to its contentLoaderInfo :)


YOUR_LOADER.contentLoaderInfo.addEventListener(Event.INIT, initHandler);


Could you try that please?

Link to comment
Share on other sites

  • 1 year later...

Is there a solution to the FLVPlayback/"Variable Icon is not defined." issue when loading a SWF containing a FLVPlayback component? From what I can gather in this case, the problem here was only solved by using another SWF that didn't contain a FLVPlayback?

Link to comment
Share on other sites

Sorry, this issue isn't something that we have heard about often, or to my recollection anywhere beyond this thread :(


It does appear the files above were downloaded 40 times and no one has added any more feedback.


It would be very helpful if you could provide a very simple set of files that contains only enough code and assets necessary to replicate the problem. Please make sure you are using the latest version of all the GreenSock classes: http://www.greensock.com/?download=GSAP-AS3

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.