Hi, you cannot have more than one public class in a single .as file. Due to this it will not work.
On Nov 18, 10:44 am, Gerald Anto <[email protected]> wrote: > Hello Friends, > > Actually i need a class that extends a super class. > > Shall i have two classes in a single .as file? if i do like i cant get > a result > > but if i have a separate class in a package it works fine > > my previous code > > package com > { > > public class Example > { > public var status:String = "undefined"; > public function Example() > { > status = "it has value now"; > trace('status in super : '+status); > } > > } > > public class ExampleEx extends Example > { > public function ExampleEx() > { > //super(); > trace('status in subclass : '+super.status); > > } > > } > > } > > my application code > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > layout="absolute"> > <mx:Script> > <![CDATA[ > > import com.*; > import mx.controls.Alert; > > private function displayConstructor():void{ > var ex:ExampleEx = new ExampleEx(); > > } > ]]> > </mx:Script> > > <mx:Button label="click" click="displayConstructor()"/> > </mx:Application> > > -- it is not working ? > Is it possible???? > > now my code > > package com > { > public class Example > { > public var status:String = "undefined"; > public function Example() > { > status = "it has value now"; > trace('status in super : '+status); > } > > } > > } > > package com > { > public class ExampleEx extends Example > { > public function ExampleEx() > { > //super(); > trace('status in subclass : '+super.status); > > } > > } > > } > > my application code > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > layout="absolute"> > <mx:Script> > <![CDATA[ > > import com.*; > import mx.controls.Alert; > > private function displayConstructor():void{ > var ex:ExampleEx = new ExampleEx(); > > } > ]]> > </mx:Script> > > <mx:Button label="click" click="displayConstructor()"/> > </mx:Application> > > -- It is working fine. > > Thanks&Regards, > Gerald A -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/flex_india?hl=.

