Hi!
I have a function:
Actionscript Code:
function changeCursor(Event:MouseEvent):void
{
trace("AS3 is imposible to understand");
}
And I have a mc on the stage that have a code inside to attach a scroll from the library. This scroll load a mc called "Rotuladores1", and inside this mc I have my button "r1".
The "r1" button have this code:
Actionscript Code:
r1.addEventListener(MouseEvent.CLICK, r1Handler);
function r1Handler(event:MouseEvent):void{
Rotuladores1(parent).changeCursor();
}
This is the code I've used in the mc to attach the scroll to the stage:
Actionscript Code:
stop();
//scroll
import fl.controls.ScrollBar;
import fl.events.ScrollEvent;
var mc:Rotuladores1 = new Rotuladores1();
mc.x = 7;
mc.y = 360;
var mcMask:MovieMaskMC = new MovieMaskMC();
mcMask.x = mc.x;
mcMask.y = mc.y;
mc.mask = mcMask;
var sb:ScrollBar = new ScrollBar();
sb.x = mc.x + mc.width;
sb.y = mc.y;
sb.height = 164;
sb.enabled = true;
sb.setScrollProperties(mcMask.height, 0, (mc.height-mcMask.height));
sb.addEventListener(ScrollEvent.SCROLL, scrollMC);
parent.addChild(mc);
parent.addChild(mcMask);
parent.addChild(sb);
function scrollMC(event:ScrollEvent):void
{
mc.y = -event.position + mcMask.y;
}
But when I press the button I get this error:
TypeError: Error #1034: Type Coercion failed: cannot convert Main@31f590e1 to Rotuladores1.
at Rotuladores1/r1Handler()
How can I call the function in the main timeline from that button?
Thanks.