PDA

View Full Version : embedPano compiling error


neil
05-06-2008, 03:33 AM
Does anyone know what this compiler error means? I get the following message when saving out a swf file from an embed FLA project based on the FLA Denis supplied:

"1118: Implicit coercion of a value with static type flash.display : DisplayObject to a possibly unrelated type flash.display:MovieClip."

The message relates to line 13 of Denis's code- "panorama = loader.content;"

I have checked all related paths and have included the latest plugins. This error has come up from time to time when compiling embedPano projects but I can't remember how I fixed it.

Thanks in advance, Neil

cheathamlane
05-06-2008, 03:57 AM
Hi Neil!

Try changing the Publish Settings to not use "Strict"... Warnings mode seems to be OK.

I haven't yet found a method for embedding FPP which doesn't throw an error when using Strict settings.

Cheers,

neil
05-06-2008, 04:11 AM
Hi Patrick,

Thanks for the tip! Now I just have to find out what's really stopping the project from working!

Neil

zleifr
05-08-2008, 12:51 AM
You can compile with "strict" compilation if you cast your variables correctly. I believe that in this case you are trying to set a display object (panorama) equal to a movieclip (loader.content). This isn't necessarily the end of the world since MovieClip inherits from DisplayObject, and so you can cast it as such, and the the compiler won't complain. Hypothetically, had you tried to cast it as an integer, for example, the casting operation would fail, since the types aren't related.

This is the code you need:

panorama = loader.content as MovieClip;
or
panorama = loader.content as DisplayObject

Depending on which is which. The other option is this:
panorama = MovieClip(loader.content) or panorama = DisplayObject(loader.content)

Zephyr

Trausti Hraunfjord
05-08-2008, 01:09 AM
WB Zephyr.... you have been missed!!

cheathamlane
05-08-2008, 01:17 AM
panorama = loader.content as MovieClip;


Well, there you go -- stupid old "as".

:)

That works like a charm... Good eye Z!


(Sure, WB, whatever... He's just been lazy, Tuddi. Besides, what am I chopped liver? ;) )

zleifr
05-08-2008, 02:42 AM
Hi Tuddi,

Thanks for the welcome back. I've just been way too busy with my other job, and that's where the big (well bigger...) money is.

Patrick = chopped liver = that's what you get for calling me lazy ;-?

Zephyr

Trausti Hraunfjord
05-08-2008, 03:28 AM
Besides, what am I chopped liver? ;) )


Nah... I wouldn't say that...but if you'd be off the compass for too long, you'd be missed as well.

.... Chopped liver is good, if it has enough good stuff on the side.... so ... well... I don't want to come down as a liver hater ;) It's good, you are good too!

cheathamlane
05-08-2008, 05:36 AM
@Z and @T:

Ha, fair enough - -maybe I'll take a break then. ;)

Cheers,

neil
05-08-2008, 06:06 AM
Thanks to you both Patrick and Zephyr.

The "as MovieClip" addition worked in strict mode. The rest of the issues were, as usual, path issues. I can't count how many hours I could save if I could proof read my own file paths properly!

Neil