I am trying to control the size of the scroll bar from another class and I tried every way i could think of but still fails. I think its because i am not calling the class the correct way. Could anyone kind enough to show me what’s wrong with my script? Thanx!
The class that calls the scrollbar
package {
import flash.display.*;
import flash.events.*;
import gs.*;
import fl.motion.easing.*;
public class scrollBar extends Sprite {
public var fullScroll:FullScreenScrollBar;
public function scrollBar() {
addEventListener(Event.ADDED_TO_STAGE,onAddedToStage);
}
private function onAddedToStage(event:Event):void {
removeEventListener(Event.ADDED_TO_STAGE,onAddedToStage);
init();
}
private function init():void {
var loadIn:loading=new loading ;
addChild(loadIn);
fullScroll=new FullScreenScrollBar(loadIn,0x222222,0x333333,0xCC0000,0xffffff,15,15,4,true);
addChild(fullScroll);
}
}
}
The class the activate the resize of the scrollbar
package {
import flash.display.*;
import flash.events.Event;
import gs.*;
import fl.motion.easing.*;
public class loading extends Sprite {
public var scrollB:scrollBar=new scrollBar;
public var fullScroll:FullScreenScrollBar;
public function loading():void {
addEventListener(Event.ADDED_TO_STAGE,onAddedToStage);
}
private function onAddedToStage(event:Event):void {
trace(scrollB.fullScroll.height);
stage.addEventListener(Event.RESIZE,stageResize);
stage.dispatchEvent(new Event(Event.RESIZE));
}
private function stageResize(event:Event=null):void {
**scrollB.fullScroll.adjustSize()**
}
}
}
Here’s the error that i get
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at MethodInfo-103()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at gs::TweenLite/complete()
at gs::TweenLite/render()
at gs::TweenLite$/updateAll()