[flexcoders] Re: rewriting a function using prototype?

2009-12-29 Thread mitchgrrt
I see.  Thanks!

- Mitch

--- In flexcoders@yahoogroups.com, jamesfin james.alan.finni...@... wrote:

 
 
 I've used this in this pasta bit more verbose but does the trick.
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
 creationComplete=createJunk()
 
 
 mx:Script
   ![CDATA[
   
 import mx.controls.Alert;
 
 public static function createJunk():void {
   
 var j:junk1 = new junk1();
 
 // style 1 outputs base f1
 j.f1();
 
 // style 2 outputs base f1
 j[f1]();
 
 // ooops, have a bug in base f1, reassign it!
 j.dF1 = function():void{trace(junk1 f1 override);}; 
 
 
 // override f1 outputs junk1 f1 override
 j[f1]();
 }
 
 
   ]]
 /mx:Script
 
 /mx:Application
 
 
 
  package {
  
   public class junk1 {
   import mx.controls.Alert;
   
   public var dF1:Function = realf1;
   
   public function f1():void { 
   dF1();
   }
 
   private function realf1():void{
   trace(base f1);
   }
 }
  }
 
 
 
 
 
 --- In flexcoders@yahoogroups.com, mitchgrrt mitch_gart@ wrote:
 
  In the generated classes there's a hierarchy.  The one with the function I 
  want to override is a base class of another class.  If I extend and 
  override, the other classes in the hierarchy won't get my fix.
  
  --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:
  
   How about extending the Ant generated classes and overriding the function?
   
   Paul
 





[flexcoders] Re: rewriting a function using prototype?

2009-12-29 Thread Ariel J
Thats neat.

--- In flexcoders@yahoogroups.com, jamesfin james.alan.finni...@... wrote:

 
 
 I've used this in this pasta bit more verbose but does the trick.
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
 creationComplete=createJunk()
 
 
 mx:Script
   ![CDATA[
   
 import mx.controls.Alert;
 
 public static function createJunk():void {
   
 var j:junk1 = new junk1();
 
 // style 1 outputs base f1
 j.f1();
 
 // style 2 outputs base f1
 j[f1]();
 
 // ooops, have a bug in base f1, reassign it!
 j.dF1 = function():void{trace(junk1 f1 override);}; 
 
 
 // override f1 outputs junk1 f1 override
 j[f1]();
 }
 
 
   ]]
 /mx:Script
 
 /mx:Application
 
 
 
  package {
  
   public class junk1 {
   import mx.controls.Alert;
   
   public var dF1:Function = realf1;
   
   public function f1():void { 
   dF1();
   }
 
   private function realf1():void{
   trace(base f1);
   }
 }
  }
 
 
 
 
 
 --- In flexcoders@yahoogroups.com, mitchgrrt mitch_gart@ wrote:
 
  In the generated classes there's a hierarchy.  The one with the function I 
  want to override is a base class of another class.  If I extend and 
  override, the other classes in the hierarchy won't get my fix.
  
  --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:
  
   How about extending the Ant generated classes and overriding the function?
   
   Paul
 





[flexcoders] Re: rewriting a function using prototype?

2009-12-28 Thread mitchgrrt
In the generated classes there's a hierarchy.  The one with the function I want 
to override is a base class of another class.  If I extend and override, the 
other classes in the hierarchy won't get my fix.

--- In flexcoders@yahoogroups.com, Paul Andrews p...@... wrote:

 How about extending the Ant generated classes and overriding the function?
 
 Paul




[flexcoders] Re: rewriting a function using prototype?

2009-12-28 Thread jamesfin


I've used this in this pasta bit more verbose but does the trick.

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
creationComplete=createJunk()


mx:Script
![CDATA[

  import mx.controls.Alert;

  public static function createJunk():void {

  var j:junk1 = new junk1();

  // style 1 outputs base f1
  j.f1();
  
  // style 2 outputs base f1
  j[f1]();

  // ooops, have a bug in base f1, reassign it!
  j.dF1 = function():void{trace(junk1 f1 override);}; 


  // override f1 outputs junk1 f1 override
  j[f1]();
  }

  
]]
/mx:Script

/mx:Application



 package {
 
public class junk1 {
import mx.controls.Alert;

public var dF1:Function = realf1;

public function f1():void { 
dF1();
}

private function realf1():void{
trace(base f1);
}
}
 }





--- In flexcoders@yahoogroups.com, mitchgrrt mitch_g...@... wrote:

 In the generated classes there's a hierarchy.  The one with the function I 
 want to override is a base class of another class.  If I extend and override, 
 the other classes in the hierarchy won't get my fix.
 
 --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:
 
  How about extending the Ant generated classes and overriding the function?
  
  Paul