Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dispatchEvent inconsistencies with <f:Screen> & <f:PanelScreen> #16

Closed
izzmeifter opened this issue Aug 25, 2015 · 8 comments
Closed

dispatchEvent inconsistencies with <f:Screen> & <f:PanelScreen> #16

izzmeifter opened this issue Aug 25, 2015 · 8 comments

Comments

@izzmeifter
Copy link

My current project uses both Screen and PanelScreen as views. Just noticed that Screen uses dispatchEvent(starling.events.Event) while PanelScreen uses dispatchEvent(flash.events.Event).

This is a bit of a problem when expecting a specific event in mediators etc.

@joshtynjala
Copy link
Member

Both classes use starling.events.Event. They're both Starling display objects, so it would be impossible to dispatch flash.events.Events from either one of them.

@izzmeifter
Copy link
Author

Perhaps I didn't explain it correctly (apologies)

Here's 2 screenshots showing the problem. Note the highlighted error. in both cases i haven't imported any Event classes, so you can see how the 2 screens expect different Event types (starling vs flash)

If I import starling.events.Event the error will reverse.

screen shot 2015-08-25 at 10 01 19 am
screen shot 2015-08-25 at 10 01 29 am

Does that make sense?

@teotidev
Copy link

Ah yes, you need to explicitly write;

dispatchEvent(new starling.events.Event( starling.events.Event.COMPLETE))

I think this is a limitation of the compiler trying to automatically say its a Flash event.

@joshtynjala
Copy link
Member

This is most likely a false error from your IDE. The Flex SDK automatically imports flash.events.Event in any MXML file (even if you don't import this class in your fx:Script element), so IDEs expect that behavior. The Feathers SDK does not import flash.events.Event automatically in MXML files. Instead it imports starling.events.Event. IDEs don't expect that, so their internal model of what has been imported in an MXML file can be wrong.

The compiler should be able to compile the code without error, even if your IDE thinks its wrong. To make the IDE happy, you can use the fully qualified class name. It's not required, though.

@joshtynjala
Copy link
Member

A good basic rule to keep in mind when using the Feathers SDK with a Flex IDE is that you shouldn't always trust the errors shown in the editor. Double-check that the compiler gives you the same error.

@izzmeifter
Copy link
Author

You're correct, it does compile properly even though fully-qualified still shows error. - I'll make a mental note moving forward ;) - Thanks guys :)

BTW. IDE is Intelli-J

@teotidev
Copy link

I only said fully qualified because I can't stand red in the IDE. :) But yeah I forgot it compiles fine without out it.

@flexsurfer
Copy link

Oh that's why Intellij highlight starling event in gray like unused

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants