Debugging with Parsley can sometimes prove to be a night mare, since it lacks any compile time support and can be flaky as objects are injected at multiple places. I was facing problem where the injections are not working and Init methods are not triggered, it took quite a while to figure out the actual problem. I had one class [AsyncInit] for the initialization logic, but unknowingly this tag was also there on a different class which I couldn't figure out soon. And this class is not firing the Event.COMPLETE which is causing the whole injection process to halt. So beware... it's Parsley..
Now parsley 2.3 has the parser to load and understand an external config file. In general, most of the applications load a config.xml that has many configuration properties for the application on startup. I always thought this feature should always be in the framework and thanks to Parsley I reduced a few more lines of code. Adding a tag in the ContextBuilder loads the properties file. However, here we have to use .properties file instead of .xml file and I don't mind to use any of them. The syntax for adding a config.properties to load during runtime and startup is :
In this context, I have a config.properties file in the 'data' folder. The documentation explains about retrieving the values from the Parsley configuration object file directly by using properties.anyPropertyName, but just wondering if I want to access it from the application context??
Flash builder has suddenly failed to support the content assist feature while I was working on a project. I couldn't get it to working even if I restart my machine. After searching few solution, which are mostly for java-based eclipse, I found one that worked for Flash builder. It's simple, just close all the projects(not 'clean') and restart the flash builder. Now when you open the project, content assist should have resumed operation. This should have fixed the problem, sorry if it hasn't. Basically, eclipse reloads the whole project when you open the project.
Fonts are one of the most flaky things to work with in flash actionscript. However, the recent developments of actionscript 3 and flex has made it lot easier
than it used to be actionscript 2. But, should always be cautious and careful when trying to use embed fonts. In flex, the embedding of fonts is easy, as you can specify in the CSS file. Following are examples for embedding fonts in flex and actionscript 3.
This one problem every time I come across, thought if I would put the solution here, it will be a good reference to me and other developers as well.
If \n or <br>, doesn't work for any reason, you can try using these html entities, 
 or
Well, it's disappointing the first time I used the flash builder 4 after it's official release, I've got this error stating the views cannot be initialized. I've found the fix in the bug database, but is not clear as how to implement in this context.
A "workaround" is to add an empty GlobalLog class with the right signature in the Eclipse classpath.
You can do this by the following steps:
1) Download this file: http://bugs.adobe.com/jira/secure/attachment/54265/global-log-workaround.jar
2) Copy the downloaded jar file to C:\Program Files\Adobe\Adobe Flash Builder 4\plugins directory, which is nothing but the 'plugins' directory of your flash builder 4 installation.
3) Now open FlashBuilder.ini file in a notepad/text editor, from C:\Program Files\Adobe\Adobe Flash Builder 4, which is again your configuration directory in the flash builder 4 installation.
4) Add this configuration variable, *=file\:plugins/global-log-workaround.jar in the end of the file.
Now your config.ini file should look similar to this:
Drawing gradient fills has been in flash from flash 8 version. It's so easy to draw the fills whether it's a Linear gradient fill or Radial gradient fill. Though, it's easy to draw the gradients, there's are few points to get your head around when trying to draw these type of fills, of which are 'ratios', 'spreadmethod' and 'focalpoint'.
ratios:Array - An array of ratio colors in the gradient. The values ranges from 0 to 255, for example, [0,100, 255], implies that at 0 the first color will be at its highest value(original color) similarly, at 100 and 255 the rest of the two colors will be at their highest values. So, you can see a gradient from 0 to 100 and 100 and 255.
focalPointRatio:Number - This is the value between -1 and 1, with 1 at the right hand side and -1 on the left side for the focal point when a radial gradient is drawn, and is horizontal. 0 is the default value. If you want to draw the focal point on the vertical axis, the trick is to use the 'rotation' property in the createGradientBox() and rotate it at an angle to acheive the desired direction.
This is one of the errors I have stumbled upon today working on an older project. Everything was working fine until I have upgraded to flex builder 3.0.1.
Usually, my flex builder doesn't recognize the 'graphics' property and BitmapData class, in auto completion. I lately realized that I am using flex builder 3.0.0 and haven't
upgraded to the next version. After upgrading, flex builder started to give this error and few other errors on binding events such as Watcher, PropertyChangeEvent etc.
I've done all quick fixes which didn't work and couldn't get any help from web search as well. As I was messing around the problem, I've checked my flex build path and realized that it doesn't contain the framework.swc and rpc.swc files. After, adding these swc files from the sdks installation of flex(C:\Program Files\Adobe\Flex Builder 3\sdks\3.3.0\frameworks\libs) everything is kushti. Hope, this helps someone trying to fix this issue.
From today, I am going to brush-up my bitmap, animation and 3D skills in flash 9 actionscript 3.0. I started to read the books of Keith Peters and Todd yard, again. As, I continue to progress I will post some code and points so that it would be a reference to me in future. Hope, at least few things might be useful to other fellow developers, as well. First, I start with the curveTo() in AS3.
A bezier curve can be drawn using a cubic equation which has two control points that renders the curve. In flash, we can only draw quadratic beizer curves, where you can only specify one control point. The control points acts like a magnet that pulls the line towards itself.
Yes, the maximum amount of data that can transferred through local connection from one swf to the other is 40 kilo bytes. Though, in most of the case scenario's you don't require to this amount of data to be transferred. However, when dealing with large objects such as data objects(VO), images etc. you would definitely stump on this problem. The solution is to chunk the large amount of datum to portions of less than 40K, say 38,900 bytes. I was working on building a custom debugger for flash, flex and AIR last week, and faced the same problem. So, I have created a method that will queue the request to send to the debugger and check if the objects are larger than 40K and chunk them. I'll present the core logic here to chunk the messages and queue them, however it's up to you to use it where required, and customize a bit.
package LCTest {import com.kcode.flex.utils.debug.MessagePacket;
import flash.events.StatusEvent;
import flash.net.LocalConnection;
import flash.net.registerClassAlias;
import flash.utils.ByteArray;
import mx.utils.UIDUtil;
/**
*
* @author kiran.mannava
*/publicclass LCTest {publicstaticvar active:Boolean;
protected staticvar instance:Debug;
/**
* connection string to talk to an AIR application is made up of
* app# + application id + . + publisher id + : + application id
* example: app#Slave.130A080AFCC69239D6F9896EEBED2327BC93ED43.1:Slave
* to use this sample, you must fill in your appropriate connection string below
*/privatestatic const slaveLCConection:String = "app#Slave.130A080AFCC69239D6F9896EEBED2327BC93ED43.1:Slave"publicstaticfunction custom(message:String, transferObject:Object=null):void{if(active){var mp:MessagePacket = new MessagePacket();
mp.data = transferObject;
mp.message = message;
mp.guid = instance.guid;
mp.logLevel = LogLevels.CUSTOM;
instance.messQueue.push(mp);
}}publicstaticfunction getInstance():LCTest {if(!instance){
instance = new LCTest();
}return instance;
}/**
* Initialize this object; establishes a connection with the slave and starts the half/full-duplex communication
* @param p_appName
*
*/publicstaticfunction init(p_appName:String):void{// create LocalConnection
getInstance();
registerClassAlias("com.kcode.flex.utils.debug.MessagePacket", com.kcode.flex.utils.debug.MessagePacket);
instance.guid = UIDUtil.createUID();
instance.primaryLC = newLocalConnection();
instance.primaryLC.allowDomain('*');
//primaryLC.client = this;
instance.primaryLC.connect(instance.guid);
instance.lcToConsole = newLocalConnection();
instance.lcToConsole.addEventListener(StatusEvent.STATUS, instance.lcStatusChanged);
//
instance.lcToConsole.send(slaveLCConection, "testSlave");
}// slaveLC is the remote apppublicvar lcToConsole:LocalConnection = newLocalConnection();
// primaryLC is this applicationpublicvar primaryLC:LocalConnection;
privatevar isConnected:Boolean = true;
// timer to ping LocalConnectionprivatevar messQueue:Array = [];
privatevar packetFragmentSize:int = 39200;
// handle status changes, we keep checking the status of the slave,//any message queued, will be sent directly or will testSlaveprivatefunction lcStatusChanged(event:StatusEvent):void{//trace(event.level);switch(event.level){case"error":
connected = false;
instance.lcToConsole.send(slaveLCConection, "testSlave", primaryLC.domain + ':Primary');
break;
case"status":
connected = true;
if(instance.messQueue.length > 0){
instance.sendMessageToConsole();
}else{
instance.lcToConsole.send(slaveLCConection, "testSlave", primaryLC.domain + ':Primary');
}break;
}}/* Chop up a message into LocalConnection size packets */privatefunction makeMessagePackets(p_orig:MessagePacket):void{var ba:ByteArray = new ByteArray();
ba.writeObject(p_orig);
ba.position = 0;
var packets:Array = newArray();
var offset:Number = 0;
//For now left 800 Bytes availabe for packet wrapper datavarlength:int;
var finalMessage:Boolean;
while(offset < ba.length){var packet:MessagePacket = new MessagePacket();
packet.guid = p_orig.guid;
packet.isChunked = true;
if(offset + packetFragmentSize > ba.length){length = ba.length - offset;
packet.finalMessage = true;
}else{length = packetFragmentSize;
packet.finalMessage = false;
}var dataFragment:ByteArray = new ByteArray();
dataFragment.writeBytes(ba, offset, length);
dataFragment.position = 0;
packet.data = dataFragment;
instance.messQueue.push(packet);
offset += packetFragmentSize;
}}// this is where the messages are send to the slave swf, the argument error implies that// the message has exceeded the 40K limit, so should chunk into pieces..privatefunction sendMessageToConsole():void{trace("sendMessageToConsole");
try{var mp:MessagePacket = instance.messQueue.shift() as MessagePacket;
instance.lcToConsole.send(slaveLCConection, "traceOutput", mp);
trace("MessagePacket -> " + mp.guid + " - " + mp.message + " - " + mp.isChunked + " - " + mp.finalMessage + " - " + mp.timeStamp + " - ");
}catch(aErr:ArgumentError){trace(aErr.message);
instance.makeMessagePackets(mp);
instance.sendMessageToConsole();
}catch(err:Error){trace(err);
}}// receive LocalConnection responsepublicfunction invokeByDebug(... rest):void{
connected = true;
}}}