Posts in Category "Flash"

AIR 2 Wishlist

I spent a good amount of time today trying to organize and create an AIR application that would:

1) Read the number of CORES in an operating system
2) Fetch me the usages of each of those Core’s activities.

Try google searching “AS3 library to get CPU OS Core Count and activity” or any lines upon there, you won’t get much. A lot is about the new Flex 4 profiler panel instead.

No such API exists in AS3 =(

Wish list for AIR2
1) flash.system.System.getNumberOfCores();
2) flash.system.System.getCoreActivity( coreNumber:int );

Testing with AIR 2, there will be a work around with the NativeProcess API

Real Dynamic Text with Flash CS3

Dynamic text feature in flash cs3 is misleading. Now for those who do not understand what dynamic text is, here’s a little background

Static Text – This is basically any text you drag & drop, put into components on the stage.

Dynamic Text – This is the process by which you create an instance of a text-type component, give it an instance name, then reference text through ActionScript – through the .text or .htmlText properties

But there’s is a problem with this solution, you have to recompile flash!

Real Dynamic Text – This is the process where your instances of text are referenced by a data source – such as XML. Why is this good? Because to change content in your flash, you no longer have to recompile flash. You simply have to change the data in the XML

Here’s some code by which you can reference: – XML ~ E4XSyntax

import flash.events.*;
import flash.net.*;

private var xmlFile:XML;
private var xmlRequest:URLRequest;
private var xmlLoader:URLLoader;

public function someConstructor() {

xmlRequest = new URLRequest(“xmlFileNameInSameDirectory.xml”);
xmlLoader = new URLLoader();
xmlLoader.load(xmlRequest);
xmlLoader.addEventListener(Event.COMPLETE, xmlLoadingComplete);
}
private function xmlLoadingComplete(event: Event):void {

xmlFile = new XML(xmlLoader.data);

//Component instance name from Stage
//Here just set any text you wish to be “real dynamic” – in the place of your XML file.
text_mc.text = xml.*[0];
}