Re: [Flashcoders] static vars / constatnts in Movie Clips - Flash CS3
the code works fine for me... I just added the package declaration package { import SectionButton; public class SomeClass { public function SomeClass() { trace (SectionButton.ON_PRESS) } } } package { import flash.display.MovieClip; public class SectionButton extends MovieClip { // events public static const ON_PRESS:String = onPress; } } It compiles without errors and traces onPress. Cheers Juan Pablo Califano 2008/2/1, Robin Burrer [EMAIL PROTECTED]: Hi All, I want do declare a constant in a class that extends the Movieclip class. That all works fine in Flexbuilder: public class SectionButton extends MovieClip { // events public static const ON_PRESS:String = onPress; } Referring to this constant from another class seems o be fine as well (Felxbuilder does not give me a syntax error.): import SectionButton; public class SomeClass { public function SomeClass() { trace (SectionButton.ON_PRESS) } } But if I try to compile my fla file in Flash CS 3 I get the following error Message: 1119: Access of possibly undefined property ON_PRESS through a reference with static type Class. Any Ideas? Robin ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] static vars / constatnts in Movie Clips - Flash CS3
Hi All, I want do declare a constant in a class that extends the Movieclip class. That all works fine in Flexbuilder: public class SectionButton extends MovieClip { // events public static const ON_PRESS:String = onPress; } Referring to this constant from another class seems o be fine as well (Felxbuilder does not give me a syntax error.): import SectionButton; public class SomeClass { public function SomeClass() { trace (SectionButton.ON_PRESS) } } But if I try to compile my fla file in Flash CS 3 I get the following error Message: 1119: Access of possibly undefined property ON_PRESS through a reference with static type Class. Any Ideas? Robin ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] static vars / constatnts in Movie Clips - Flash CS3
Works fine for me... How are you creating SomeClass instance? like this - it's all really basic package { import flash.display.MovieClip; import de.formDivision.fdCD.view.slidePlayer.SectionButton; public class Test extends MovieClip { public function Test() { var mySectionButton:SectionButton = new SectionButton(); this.addChild(mySectionButton); // here I get the compiler error trace (SectionButton.ON_PRESS); // The foo class does not extend the Movie Clip class - no coplier errors here... var myFoo:Foo = new Foo(); trace (Foo.VALUE); } } } / and here is the SectionButton Class - I deleted everything but the static variable declaration package de.formDivision.fdCD.view.slidePlayer { import flash.display.MovieClip; import de.formDivision.fdCD.vo.SectionVO; import flash.events.MouseEvent; import flash.events.Event; public class SectionButton extends MovieClip { // events public static const ON_PRESS:String = onPress; } } On 01/02/2008, at 3:47 PM, Kenneth Kawamoto wrote: Works fine for me... How are you creating SomeClass instance? Kenneth Kawamoto http://www.materiaprima.co.uk/ Robin Burrer wrote: Hi All, I want do declare a constant in a class that extends the Movieclip class. That all works fine in Flexbuilder: public class SectionButton extends MovieClip { // events public static const ON_PRESS:String = onPress; } Referring to this constant from another class seems o be fine as well (Felxbuilder does not give me a syntax error.): import SectionButton; public class SomeClass { public function SomeClass() { trace (SectionButton.ON_PRESS) } } But if I try to compile my fla file in Flash CS 3 I get the following error Message: 1119: Access of possibly undefined property ON_PRESS through a reference with static type Class. Any Ideas? Robin ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] static vars / constatnts in Movie Clips - Flash CS3
I found the mistake. I set the id in linkage properties to SectionButton and the base class to de.formDivision.fdCD.view.slidePlayer.SectionButton as well. If I change the id to SectionButton1 it compiles fine. Thanks for your help everybody! Robin On 01/02/2008, at 3:41 PM, Juan Pablo Califano wrote: the code works fine for me... I just added the package declaration package { import SectionButton; public class SomeClass { public function SomeClass() { trace (SectionButton.ON_PRESS) } } } package { import flash.display.MovieClip; public class SectionButton extends MovieClip { // events public static const ON_PRESS:String = onPress; } } It compiles without errors and traces onPress. Cheers Juan Pablo Califano 2008/2/1, Robin Burrer [EMAIL PROTECTED]: Hi All, I want do declare a constant in a class that extends the Movieclip class. That all works fine in Flexbuilder: public class SectionButton extends MovieClip { // events public static const ON_PRESS:String = onPress; } Referring to this constant from another class seems o be fine as well (Felxbuilder does not give me a syntax error.): import SectionButton; public class SomeClass { public function SomeClass() { trace (SectionButton.ON_PRESS) } } But if I try to compile my fla file in Flash CS 3 I get the following error Message: 1119: Access of possibly undefined property ON_PRESS through a reference with static type Class. Any Ideas? Robin ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] static vars / constatnts in Movie Clips - Flash CS3
I'm creating the instance in the timeline of the .fla, with this line: var c:SomeClass = new SomeClass(); Have you tried that? Just to see if it works from the timeline and check if you can compile and run the code without errors... ( As I said, the code I pasted compiles fine and it traces the right value creating the instance in the timeline... (should work if done in a class too, but just to check) 2008/2/1, Robin Burrer [EMAIL PROTECTED]: Works fine for me... How are you creating SomeClass instance? like this - it's all really basic package { import flash.display.MovieClip; import de.formDivision.fdCD.view.slidePlayer.SectionButton; public class Test extends MovieClip { public function Test() { var mySectionButton:SectionButton = new SectionButton(); this.addChild(mySectionButton); // here I get the compiler error trace (SectionButton.ON_PRESS); // The foo class does not extend the Movie Clip class - no coplier errors here... var myFoo:Foo = new Foo(); trace (Foo.VALUE); } } } / and here is the SectionButton Class - I deleted everything but the static variable declaration package de.formDivision.fdCD.view.slidePlayer { import flash.display.MovieClip; import de.formDivision.fdCD.vo.SectionVO; import flash.events.MouseEvent; import flash.events.Event; public class SectionButton extends MovieClip { // events public static const ON_PRESS:String = onPress; } } On 01/02/2008, at 3:47 PM, Kenneth Kawamoto wrote: Works fine for me... How are you creating SomeClass instance? Kenneth Kawamoto http://www.materiaprima.co.uk/ Robin Burrer wrote: Hi All, I want do declare a constant in a class that extends the Movieclip class. That all works fine in Flexbuilder: public class SectionButton extends MovieClip { // events public static const ON_PRESS:String = onPress; } Referring to this constant from another class seems o be fine as well (Felxbuilder does not give me a syntax error.): import SectionButton; public class SomeClass { public function SomeClass() { trace (SectionButton.ON_PRESS) } } But if I try to compile my fla file in Flash CS 3 I get the following error Message: 1119: Access of possibly undefined property ON_PRESS through a reference with static type Class. Any Ideas? Robin ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] static vars / constatnts in Movie Clips - Flash CS3
Works fine for me... How are you creating SomeClass instance? Kenneth Kawamoto http://www.materiaprima.co.uk/ Robin Burrer wrote: Hi All, I want do declare a constant in a class that extends the Movieclip class. That all works fine in Flexbuilder: public class SectionButton extends MovieClip { // events public static const ON_PRESS:String = onPress; } Referring to this constant from another class seems o be fine as well (Felxbuilder does not give me a syntax error.): import SectionButton; public class SomeClass { public function SomeClass() { trace (SectionButton.ON_PRESS) } } But if I try to compile my fla file in Flash CS 3 I get the following error Message: 1119: Access of possibly undefined property ON_PRESS through a reference with static type Class. Any Ideas? Robin ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders