ptfury
April 20th, 2008, 07:19 PM
i cannot use the color picker component.. it gives me an error:
"1120: Access of undefined property options."
here is my class ( i made a Bold on what calls the problem ):
package project
{
import caurina.transitions.Tweener;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.display.SimpleButton;
import flash.display.Loader;
import flash.net.URLLoader;
import flash.display.DisplayObject;
import flash.utils.setTimeout;
import fl.controls.ColorPicker;
import fl.events.ColorPickerEvent;
public dynamic class Icons extends MovieClip
{
private var _currentButton:SimpleButton;
private var _buttons:Array;
public function Icons()
{
changeColor();
this.options.alpha=0;
this._buttons = [this.options.btMais,this.options.btMenos,this.opti ons.btDta,this.options.btEsq,this.options.btApagar];
for (var i:int = 0; i < _buttons.length; i++)
{
_buttons[i].addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
_buttons[i].addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
_buttons[i].addEventListener(MouseEvent.MOUSE_DOWN, mouseClick);
}
this.icon_.addEventListener(MouseEvent.MOUSE_DOWN, startdrag)
this.icon_.addEventListener(MouseEvent.MOUSE_UP, stopdrag);
this.icon_.addEventListener(MouseEvent.MOUSE_OVER, showMenus)
this.options.btClose.addEventListener(MouseEvent.M OUSE_DOWN, hideMenus)
}
public function get buttons():Array
{
return this._buttons;
}
private function mouseOverHandler(event:MouseEvent):void
{
Tweener.addTween(event.target, {scaleX:1.1,scaleY:1.1, time:0.5, transition:"easeOutQuad"});
}
private function mouseOutHandler(event:MouseEvent):void
{
Tweener.addTween(event.target, {scaleX:1,scaleY:1, time:0.5, transition:"easeInQuad"});
}
private function mouseClick(event:MouseEvent):void
{
this._currentButton = SimpleButton(event.target);
if(event.target.name=="btMais")
{
this.icon_.scaleX=this.icon_.scaleX+0.1;
this.icon_.scaleY=this.icon_.scaleY+0.1;
this.options.x=this.options.x+5;
}
if(event.target.name=="btMenos")
{
this.icon_.scaleX=this.icon_.scaleX-0.1;
this.icon_.scaleY=this.icon_.scaleY-0.1;
this.options.x=this.options.x-5;
//var currentColor=0x002233;
//var currentColor=options.cpColor.selectedColor;
//Tweener.addTween(this.icon_, {_color:currentColor, time:1 });
}
if(event.target.name=="btDta")
{
this.icon_.rotation=this.icon_.rotation+10;
}
if(event.target.name=="btEsq")
{
this.icon_.rotation=this.icon_.rotation-10;
}
if(event.target.name=="btApagar")
{
this.visible=false;
}
}
private function startdrag(event:MouseEvent):void
{
this.startDrag();
}
private function stopdrag(event:MouseEvent):void
{
this.stopDrag();
}
private function showMenus(event:MouseEvent):void
{
Tweener.addTween( this.options, {alpha:1, time:0.5});
}
private function hideMenus(event:MouseEvent):void
{
Tweener.addTween( this.options, {alpha:0, time:0.5});
//this.options.visible=false;
}
private function changeColor (event:ColorPickerEvent)
{
var currentColor=options.cpColor.selectedColor;
Tweener.addTween(this.icon_, {_color:currentColor, time:1 });
}
}
}
thanks for the help :)
"1120: Access of undefined property options."
here is my class ( i made a Bold on what calls the problem ):
package project
{
import caurina.transitions.Tweener;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.display.SimpleButton;
import flash.display.Loader;
import flash.net.URLLoader;
import flash.display.DisplayObject;
import flash.utils.setTimeout;
import fl.controls.ColorPicker;
import fl.events.ColorPickerEvent;
public dynamic class Icons extends MovieClip
{
private var _currentButton:SimpleButton;
private var _buttons:Array;
public function Icons()
{
changeColor();
this.options.alpha=0;
this._buttons = [this.options.btMais,this.options.btMenos,this.opti ons.btDta,this.options.btEsq,this.options.btApagar];
for (var i:int = 0; i < _buttons.length; i++)
{
_buttons[i].addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
_buttons[i].addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
_buttons[i].addEventListener(MouseEvent.MOUSE_DOWN, mouseClick);
}
this.icon_.addEventListener(MouseEvent.MOUSE_DOWN, startdrag)
this.icon_.addEventListener(MouseEvent.MOUSE_UP, stopdrag);
this.icon_.addEventListener(MouseEvent.MOUSE_OVER, showMenus)
this.options.btClose.addEventListener(MouseEvent.M OUSE_DOWN, hideMenus)
}
public function get buttons():Array
{
return this._buttons;
}
private function mouseOverHandler(event:MouseEvent):void
{
Tweener.addTween(event.target, {scaleX:1.1,scaleY:1.1, time:0.5, transition:"easeOutQuad"});
}
private function mouseOutHandler(event:MouseEvent):void
{
Tweener.addTween(event.target, {scaleX:1,scaleY:1, time:0.5, transition:"easeInQuad"});
}
private function mouseClick(event:MouseEvent):void
{
this._currentButton = SimpleButton(event.target);
if(event.target.name=="btMais")
{
this.icon_.scaleX=this.icon_.scaleX+0.1;
this.icon_.scaleY=this.icon_.scaleY+0.1;
this.options.x=this.options.x+5;
}
if(event.target.name=="btMenos")
{
this.icon_.scaleX=this.icon_.scaleX-0.1;
this.icon_.scaleY=this.icon_.scaleY-0.1;
this.options.x=this.options.x-5;
//var currentColor=0x002233;
//var currentColor=options.cpColor.selectedColor;
//Tweener.addTween(this.icon_, {_color:currentColor, time:1 });
}
if(event.target.name=="btDta")
{
this.icon_.rotation=this.icon_.rotation+10;
}
if(event.target.name=="btEsq")
{
this.icon_.rotation=this.icon_.rotation-10;
}
if(event.target.name=="btApagar")
{
this.visible=false;
}
}
private function startdrag(event:MouseEvent):void
{
this.startDrag();
}
private function stopdrag(event:MouseEvent):void
{
this.stopDrag();
}
private function showMenus(event:MouseEvent):void
{
Tweener.addTween( this.options, {alpha:1, time:0.5});
}
private function hideMenus(event:MouseEvent):void
{
Tweener.addTween( this.options, {alpha:0, time:0.5});
//this.options.visible=false;
}
private function changeColor (event:ColorPickerEvent)
{
var currentColor=options.cpColor.selectedColor;
Tweener.addTween(this.icon_, {_color:currentColor, time:1 });
}
}
}
thanks for the help :)