Thursday, July 31, 2008
Thursday, July 31, 2008  0 Comments   Links to this post   

Testing MXML support. Found this @ Shigeru Nakagaki (part of a post: AIR:How to use RemoteObject without compiler option.)
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication layout="vertical"
xmlns:mx="http://www.adobe.com/2006/mxml"
applicationComplete="init()">

<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.remoting.mxml.RemoteObject;

private function init():void
{
//
}

private function resultHandler(e:ResultEvent):void
{
log.text = e.result.toString() + "\n" + log.text;
}

private function faultHandler(e:FaultEvent):void
{
Alert.show(e.fault.message);
}

private function sendMessage():void
{
// call CFC method with arguments
ro.echo(msg.text);

msg.text = "";
}

]]>
</mx:Script>

<mx:RemoteObject id="ro"
destination="ColdFusion"
endpoint="http://127.0.0.1/flex2gateway/"
source="AirRemoting.BlazeDSCFCTest3"
result="resultHandler(event)"
fault="faultHandler(event)" />

<mx:HBox>
<mx:TextInput id="msg" />
<mx:Button label="send" click="sendMessage()" />
</mx:HBox>

<mx:TextArea id="log" width="200" height="200" />


</mx:WindowedApplication>

Labels: ,

Wednesday, June 11, 2008
Wednesday, June 11, 2008  0 Comments   Links to this post   

We've all been acquainted with String.fromCharCode in relationship to event.keyCode, but it also works with Number. Why would you want to do that?

Well, I am getting sets of keyboard inputs as keyCodes from a piece of hardware, and I build up an angle to use. A delimiter lets me know when to stop per each set.

In order to translate the keyCodes back to numbers for use in building up the angle to use, instead of using a method to translate the keyCodes to a Number to use, you can simply do something like this:

var code:Number = event.keyCode;
var n:Number = Number.fromCharCode( code );

And from this I build up an array, looking for a delimiter all the time, and when I get the delimiter, build the angle number and use it. Of course this fails if you are getting keyCodes that are out of range of 0-9, so you need to filter your keyCodes as they come in.

I haven't seen any public code (yet) that uses Number.fromCharCode yet, and for me it works perfectly, so I thought I'd throw this out there.

Labels: ,

Friday, July 6, 2007
Friday, July 6, 2007  0 Comments   Links to this post   

I am testing the display of some code, since I am migrating CSS and other things, I'd like to try to ensure a sweet transition when the DNS changes take place. This is just a piece of larger code stuff.

package
{
import flash.display.DisplayObject;
import flash.events.Event;
import flash.display.Sprite;
import flash.geom.ColorTransform;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;

// XML-Specific
import flash.events.ErrorEvent;
import flash.xml.XMLDocument;
import flash.net.URLLoader;
import flash.net.URLRequest;

/**
* AS3.0 Class to provide user selection of various
* Flash-specific resource documentation/files.
*
* Author: Eric E. Dolecki
* Copyright: 2007, Eric E. Dolecki
*/
public class Resources extends Sprite
{
private var BaseColor:Number = 0x414042;
private var RollOverColor:Number = 0xCCC2C0;
private var SelectedColor:Number = 0xF15B40;
private var navArray;
private var nCurrentSelection:Number = 0;
public var sectionId = "";

// XML-Specific
private var urlLoader:URLLoader;
public static var data:XML;

public function Resources()
{
navArray = new Array();
xmlLoader();
};
}
}

Labels: ,

gotoAndStop( topOfPage );