views:

20

answers:

1

Hi2all! Earlier i used following structure:

Canvas -> Screen1
Canvas -> Screen2

When I feel need in common logic in my application I do next:

Canvas -> Screen
Screen -> Screen1
Screen -> Screen2

So when I try to apply it in my code

if(child is Screen){
    return child.localToGlobal(new Point()).x;
}

It is not works! When I see in debugger, child have type "Screen2", but "child is Screen" returns false to me (and "child instanceof Screen" too). When I apply compiler key: "-keep-generated-actionscript" I can see Screen2-generated.as and it's contains

public class Screen3 extends screens.Screen

Thanks in advance Sorry for my ugly english=)

+2  A: 

I think the issue is with this specific name - there already is a class called Screen (in flash.display - http://livedocs.adobe.com/flex/3/langref/flash/display/Screen.html), and Flex checks if it's an instance of the original screen.

You can try two things:

1) Rename your Screen class to CustomScreen and try it again.

2) Check if the child is an instance of your class by referencing it full path eg. if (child is screens.Screen)

Robert Bak
Yeah!! Thanks for thinking about it!
semen