Friday, June 25, 2010
Determining Flash Player version in Flex
Flash.system.Capabilities.version and Flash.system.Capabilities.isDebugger are the properties to determine the flash player version
Tuesday, June 22, 2010
Flex name spaces
Controlling method access with name spaces
You could call a different version of calcTax method using the name space soprano with a double colon as shown
tax = Tax.soprano::calcTax();
package com.enron.namespaces {
public namespace soprano=”http://www.enron.com/namespaces”;
}
package com.enron.namespaces {
public namespace regular;
}
package com.enron.tax{
import com.enron.namespaces.*;
public class Tax
{
regular static function calcTax():Number{
return 3500;
}
soprano static function calcTax():Number{
return 1750;
}
}
}
You could call a different version of calcTax method using the name space soprano with a double colon as shown
tax = Tax.soprano::calcTax();
package com.enron.namespaces {
public namespace soprano=”http://www.enron.com/namespaces”;
}
package com.enron.namespaces {
public namespace regular;
}
package com.enron.tax{
import com.enron.namespaces.*;
public class Tax
{
regular static function calcTax():Number{
return 3500;
}
soprano static function calcTax():Number{
return 1750;
}
}
}
Flex Stage Object
The Stage class represents the main drawing area.
For SWF content running in the browser (in Flash® Player), the Stage represents the entire area where Flash content is shown.
For content running in AIR, each NativeWindow object has a corresponding Stage object.
Reference to Stage object is null until applicationComplete() event - thats where you typically should add any listeners to the stage object
For SWF content running in the browser (in Flash® Player), the Stage represents the entire area where Flash content is shown.
For content running in AIR, each NativeWindow object has a corresponding Stage object.
Reference to Stage object is null until applicationComplete() event - thats where you typically should add any listeners to the stage object
Flex 3 to Flex 4
Features & Migration Guide from Adobe lists them all - pretty useful. Wonder why did not see this earlier
Flash Player 10 in Flex Builder 3.0.2
This is a good post which highlights the steps
What we essentially gotta do
a) Install sdk 3.2 & configure it
b) Remove playerglobal.swc from the existing project build path libraries list and point to Flash Player 10 playerglobal.swc file as a merged link.
This file is is in C:\Program Files\Adobe\Flex Builder 3\sdks\3.2.0.3794\frameworks\libs\player\10
What we essentially gotta do
a) Install sdk 3.2 & configure it
b) Remove playerglobal.swc from the existing project build path libraries list and point to Flash Player 10 playerglobal.swc file as a merged link.
This file is is in C:\Program Files\Adobe\Flex Builder 3\sdks\3.2.0.3794\frameworks\libs\player\10
Thursday, June 17, 2010
Singleton in ActionScript!
This is how you'd go about creating a Singleton in ActionScript! Create another class within the same file but outside the package declaration - so that it can only be accessed internally:
package{
public class Singleton{
private static var _instance:Singleton=null;
public function Singleton(e:SingletonEnforcer){
trace(‘new instance of singleton created’);
}
public static function getInstance():Singleton{
if(_instance==null){
_instance=new Singleton(new SingletonEnforcer());
}
return _instance;
}
}
}
//I’m outside the package so I can only be accessed internally
class SingletonEnforcer{
//nothing else required here
}
package{
public class Singleton{
private static var _instance:Singleton=null;
public function Singleton(e:SingletonEnforcer){
trace(‘new instance of singleton created’);
}
public static function getInstance():Singleton{
if(_instance==null){
_instance=new Singleton(new SingletonEnforcer());
}
return _instance;
}
}
}
//I’m outside the package so I can only be accessed internally
class SingletonEnforcer{
//nothing else required here
}
Subscribe to:
Posts (Atom)