Hi there, I'm saving a bunch of colours as a string then using this string
later to colour objects in the same way.  Something is going wrong though as
the colours I am getting back are not the same as the ones I put in.
If anyone could point out where I'm going wrong I'd be really grateful, I've
googled this and and have checked the help files and as far as I can see
it's correct (though obviously it isn't!).

Here's my code, I've written comments next to the relevant lines:

/// in my coloured button class

//  1) colour is set on mouse click
private function clickHandler(e:MouseEvent):void
// passes hexValue from ColorPicker
//  2) color is stored in var
public function colorThis(c:String):void
//stores colour
currColor = Number("0x"+c);
var newColorTransform:ColorTransform = this.transform.colorTransform;
newColorTransform.color = currColor;
this.transform.colorTransform = newColorTransform;

// application class
 //  3) stores colors in an array
private function collectColors():Array
colors_ar = new Array();
for ( var i:uint=1; i<=totSprites; i++ ) {
//stores colour in array
colors_ar[i] = mainImage["s"+i].currColor;
return colors_ar;

//  4) array is written to string and sent to php to be written to txt file

private function sendData(e:MouseEvent):void
var variables:URLVariables = new URLVariables();
//stores all colours as a string
variables.colors = collectColors().toString();
var request:URLRequest = new URLRequest();
request.url = "http://www.xxxx.com/text/test.php";;
request.method = URLRequestMethod.POST;
request.data = variables;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.addEventListener(Event.COMPLETE, completeHandler);
catch (error:Error)
    trace("Unable to load URL");

/////////   viewer class
//  5)

public function colorIn(o:Object):void
var colA:Array = o.Colors.split(",");
for ( var i:uint=1; i<=totSprites; i++ ) {
//calls the method in the coloured button class
Flashcoders mailing list

Reply via email to