Promote Variable

Is there a command or shortcut to promote a variable?

for example

public function test():void{

     var testVar:String = "hello";

}

I would like to promote it to a class variable

private var testVar:String;

public function test():void{

     testVar= "hello";

}


thanks,
-ross

6 comments

Put the caret on the variable and press Ctrl-Alt-F (Refactor : Introduce Field).

0

hmmmm that doesnt seem to work

I place a caret on the variable and hit CTRL-ALT-F i get "Cannot Introduce field. Selection does not form an expression"

Though if i select the variable (highligh it all) and hit CTRL-ALT-F I do get the dialog but my only option is Current Method.

this is what i am using to test

var test:String = new String();


Thanks
-ross

0

I guess it must be language-specific. It works for me with Java.

0

yes, it's different per plugin

0

Soooo am i outta luck on this for Actionscript right now?

-ross

0

Please sign in to leave a comment.