PDA

View Full Version : [AS3] Scrollbar and Error 1009


muraqib
01-03-2010, 03:01 PM
Hello!

I am creating a webpage with a scrollbar and it throws me this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at fl.controls::TextArea/drawLayout()
at fl.controls::TextArea/draw()
at fl.core::UIComponent/callLaterDispatcher()

Code for the AS3 is following:

import fl.controls.ScrollBar;
import fl.events.ScrollEvent;


var mc:RainbowMC = new RainbowMC();
mc.x = (this.stage.stageWidth/2)-(mc.width/2);
mc.y = 100;

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 = mcMask.height;
sb.enabled = true;
sb.setScrollProperties(mcMask.height, 0, (mc.height-mcMask.height));
sb.addEventListener(ScrollEvent.SCROLL, scrollMC);

this.addChild(mc);
this.addChild(mcMask);
this.addChild(sb);

function scrollMC(event:ScrollEvent):void{
mc.y = -event.position + mcMask.y;
}

I have tried to look for a solution for a long time but have not found it yet, hopefully some of you could help me!
When I publish it in my computer, it works without errors, but on the server it throws this error!
I am using adobe flash CS4

Thank you in advance!