Error #2044: Unhandled IOErrorEvent:. text=Error #2124: Loaded file is an unknown type.

1,297 views
Skip to first unread message

JasonJ

unread,
Oct 14, 2009, 10:04:16 PM10/14/09
to Justin.tv API Developers
Anyone getting this error trying out the simple .fla loader on
available on the wiki? I just started working with this part of the
API and can't seem to get this figured.

The code fails on the
loader.load(urlrequest(https://www.justin.tv/widgets/jtv_api.swf?....)

when I put in my consumer key as part of the querystring and post the
full address to firefox I get an swf returned but I can't seem to get
the thing working with the .fla file. I am using Flash CS4.

Thanks, in advance, for any insight you might have.

Bob Poekert

unread,
Oct 14, 2009, 11:52:03 PM10/14/09
to Justin.tv API Developers
Can you paste the code that you're having trouble with?

--Bob

JasonJ

unread,
Oct 15, 2009, 12:32:53 AM10/15/09
to Justin.tv API Developers
Yeah, its just the .fla file that is an example from the wiki:

Of course, the URL reference has my own API key in it, but the
following is what I am using in an FLA and attempting to test it out
to start building something.

// You must allow justin.tv; for simplicity of developing against
localhost as well I've allowed *
flash.system.Security.allowDomain("*");

// You must use these settings; otherwise our player will go crazy.
You should be using these settings anyway because they're better.
stage.scaleMode = flash.display.StageScaleMode.NO_SCALE;
stage.align = flash.display.StageAlign.TOP_LEFT;

// Create the loader!
var loader = new flash.display.Loader();
trace("loader created");

// Handler for when you've loaded the swf
function loaded(e){
// Add the loader to the stage
addChild(loader);
// Access the API!
loader.content.api.play_live("apidemo");
}

// When we're done loading, trigger the callback
loader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE,
loaded);

// Load the player at 640x480 size (video will be automatically
leterrboxed properly)
loader.load(new flash.net.URLRequest("http://www.justin.tv/widgets/
jtv_api.swf?video_height=480&video_width=640&consumer_key=My_KEY"));

Ernani Joppert Pontes Martins

unread,
Oct 15, 2009, 4:43:32 AM10/15/09
to justintv-ap...@googlegroups.com
I am also curious on how to destroy this SWF object when not needed.

It seems to be kept in memory no matter what I do.

And when I am loading a new channel, it keeps increasing the memory and loading on top of the last used.

That's very weird, but I lack on understanding how the loader behaves under the hood.

Thanks in advance,

Cheers,

Ernani

JasonJ

unread,
Oct 15, 2009, 9:54:57 PM10/15/09
to Justin.tv API Developers
figured it out:

// You must allow justin.tv; for simplicity of developing against
localhost as well I've allowed *
flash.system.Security.allowDomain("*");

didn't work. Once I set to the following line, it works fine.

// You must allow justin.tv; for simplicity of developing against
localhost as well I've allowed *
flash.system.Security.allowDomain("justin.tv");

then you can add another

flash.system.Security.allowDomain("localhost");

to allow your localhost

YAY

Ernani Joppert Pontes Martins

unread,
Oct 15, 2009, 10:00:06 PM10/15/09
to justintv-ap...@googlegroups.com
What about the unloading of the object?

Anybody has any concerns?

I want to reproduce something like a new instance of this loader for each channel I want and unload it and garbage collect them as required by my application.

Does anybody has any clues?

Cheers,

Ernani

Bob Poekert

unread,
Oct 15, 2009, 10:02:23 PM10/15/09
to justintv-ap...@googlegroups.com
flash.display.Loader has an unload method ( http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html#unload() ) which you could try.

--Bob

Ernani Joppert Pontes Martins

unread,
Oct 15, 2009, 10:08:28 PM10/15/09
to justintv-ap...@googlegroups.com
I have been dealing with the unload method, but it does not seem to work fine.

I am using some profiling tools and also the sound keeps running after the unload call.

Perhaps there is another way I am unaware of, I've even tried to call the gc method to see if that gets destroyed, but it does not, the sound keeps running :S

I may have to check with some adobe folks on their forums somehow.

Thanks a lot, I appreciate your reply.

Cheers,

Ernani

JasonJ

unread,
Oct 15, 2009, 10:37:07 PM10/15/09
to Justin.tv API Developers
I don't know what is up with this thing but I am getting the unknown
type error again. I have been getting it to work intermittently by
changing up that bit of code I mentioned earlier:

flash.system.Security.allowDomain("*.justin.tv");
flash.system.Security.allowDomain("justin.tv");
flash.system.Security.allowDomain("www-cdn.justin.tv");
flash.system.Security.allowDomain("localhost");
flash.system.Security.allowDomain("*");

I have all of these in there now and go between them, it will work for
about 3 times and then start throwing the error again for 20 mins or
so and start working again.

I am frustrated.

-Jason

On Oct 15, 7:08 pm, Ernani Joppert Pontes Martins <jopp...@gmail.com>
wrote:
> I have been dealing with the unload method, but it does not seem to work
> fine.
>
> I am using some profiling tools and also the sound keeps running after the
> unload call.
>
> Perhaps there is another way I am unaware of, I've even tried to call the gc
> method to see if that gets destroyed, but it does not, the sound keeps
> running :S
>
> I may have to check with some adobe folks on their forums somehow.
>
> Thanks a lot, I appreciate your reply.
>
> Cheers,
>
> Ernani
>
> On Thu, Oct 15, 2009 at 11:02 PM, Bob Poekert <b...@justin.tv> wrote:
> > flash.display.Loader has an unload method (
> >http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/displ...()<http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/displ...>) which you could try.
>
> > --Bob
>
> > On Thu, Oct 15, 2009 at 7:00 PM, Ernani Joppert Pontes Martins <
> > jopp...@gmail.com> wrote:
>
> >> What about the unloading of the object?
>
> >> Anybody has any concerns?
>
> >> I want to reproduce something like a new instance of this loader for each
> >> channel I want and unload it and garbage collect them as required by my
> >> application.
>
> >> Does anybody has any clues?
>
> >> Cheers,
>
> >> Ernani
>

JasonJ

unread,
Oct 15, 2009, 11:18:34 PM10/15/09
to Justin.tv API Developers
The more and more I play with this thing, the more and more I like
it. I am making big progress when it works, but every 20 mins or so
the api will just start throwing the unknown type error for another
10-15 mins and magically start working again. If I were to break this
into individual tries on the api, I would say every 20-30 tries make
the error come back.

Ernani Joppert Pontes Martins

unread,
Oct 16, 2009, 10:57:20 AM10/16/09
to justintv-ap...@googlegroups.com
It seems that you are not getting the proper mime type header from the server sometimes.

This may indicate that there are some connection errors and the binary swf transfer is trashing in between the communication flow.

Unfortunately you can't verify the integrity of the swf file using PGP hashes on the fly, but perhaps you can download the SWF locally and load it from your localhost environment and see if that avoids the errors.

Cheers,

Ernani

JasonJ

unread,
Oct 18, 2009, 6:30:34 PM10/18/09
to Justin.tv API Developers
Well, I loaded flash on my windows machine and magically the invalid
type error has disappeared. I guess I will just develop on my PC.

-Jason

On Oct 16, 7:57 am, Ernani Joppert Pontes Martins <jopp...@gmail.com>
wrote:
> > > > >>> > > > Thanks, in advance, for any insight you might have.- Hide quoted text -
>
> - Show quoted text -

Justin Kan

unread,
Oct 22, 2009, 6:40:13 PM10/22/09
to justintv-ap...@googlegroups.com
Weird bug, but if you have the problem again let us know. Right now we're fresh out of ideas.

Cheers,

Justin
Reply all
Reply to author
Forward
0 new messages