simple color change code doesn't work.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SpaceyFace
    New Member
    • Mar 2008
    • 5

    simple color change code doesn't work.

    i'm using AS3....i'm trying to change the color of a movie clip after i select a color from the color picker component. when i uncomment the two added lines i get errors. am i just really bad at syntax? i have no idea. this is the ONLY code in the file....i'm close to a deadline on this and i'm at a wall. if someone could guide me i'd REALLY appreciate any help i can get.

    i uploaded the flash file here just in case:
    http://www.zshare.net/download/929868106ef550/

    the code is as follows:

    import fl.events.Color PickerEvent;

    var tempColor = "0x003366";
    var aBox:MovieClip = new MovieClip();
    drawBox(aBox, 0xFF0000); //draw a red box
    addChild(aBox);



    aCp.addEventLis tener(ColorPick erEvent.CHANGE, changeHandler);

    function changeHandler(e vent:ColorPicke rEvent):void {
    drawBox(aBox, event.target.se lectedColor);
    tempColor = aCp.selectedCol or.toString();
    trace("- " + aCp.selectedCol or);
    trace("+ ", event.target.he xValue);
    //testXc = new Color(_root.tes tX);
    //testX.setRGB("0 x" + event.target.he xValue);
    }

    function drawBox(box:Mov ieClip,color:ui nt):void {
    box.graphics.be ginFill(color, 1);
    box.graphics.dr awRect(0,0,50,5 0);
    box.graphics.en dFill();
    }
Working...