Hi All, I'm fairly new to AS3 and have been working with some premade code. I am able to get this script and class file attached to my Flash file, and I can add the tooltip to a movie clip on my stage as well as a child movie clip. The problem I'm seeing now is that the script can't initialize if I put the tooltip on a different frame than the first frame of a child movie clip. I have tweening and need these tooltips to only be available at certain points in the .swf, not all from the first frame. /** Font Notes : notes, cannot have embedded and non embedded fonts in 1 field. if using a stylesheet and an embedded font, the font-family:NAME must equal the actual name of the font, not the linkage class. if using textformat create a new instance of the linkage class: var font:LINKAGE = new LINKAGE(); tf.font = font.fontName; */ package { import assets.com.hybrid.ui.ToolTip; import flash.display.*; import flash.events.*; import flash.utils.*; import flash.text.*; import flash.utils.Timer; import flash.events.TimerEvent; import flash.system.*; import flash.net.URLLoader; import flash.net.URLRequest; import flash.events.IOErrorEvent; public class Application extends MovieClip { private var _tf:TextField; private var _timer:Timer; private var _reusableTip:ToolTip; private var _sheet:StyleSheet = new StyleSheet(); public function Application(){ this.loadStyleSheet(); _reusableTip = new ToolTip(); _reusableTip.hook = true; _reusableTip.cornerRadius = 20; _reusableTip.tipWidth = 400; _reusableTip.align = "right"; _reusableTip.border = 0xadd483; _reusableTip.borderSize = 5; } private function loadStyleSheet():void { var loader:URLLoader = new URLLoader(); loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler); loader.addEventListener(Event.COMPLETE, loaderCompleteHandler); var req:URLRequest = new URLRequest("assets/styles.css"); loader.load(req); } public function errorHandler(event:IOErrorEvent):void { event.currentTarget.removeEventListener(event.type, arguments.callee); //inputField.htmlText = "Couldn't load the style sheet file."; } public function loaderCompleteHandler(event:Event):void { event.currentTarget.removeEventListener(event.type, arguments.callee); var loader:URLLoader = URLLoader(event.target); this._sheet.parseCSS(loader.data); this.initialize(); } private function initialize():void { //level1.level2.buttonMode = true; main_mc.level1.addEventListener( MouseEvent.MOUSE_OVER, this.onMouseOver ); // level1.level2.addEventListener( MouseEvent.MOUSE_DOWN, this.omd ); main_mc.test2_mc.addEventListener( MouseEvent.MOUSE_OVER, this.onMouseOver_test2_mc ); //this.debug(); } private function omd( event:MouseEvent ):void { _reusableTip.setContent( "Set A New Title", "Set Some New Content, A Little Less Than Before." ); } private function onMouseOver( event:MouseEvent ):void { /* _reusableTip = new ToolTip(); _reusableTip.hook = true; _reusableTip.cornerRadius = 20; _reusableTip.tipWidth = 260; _reusableTip.align = "right"; _reusableTip.border = 0xFF0000; _reusableTip.borderSize = 5; */ _reusableTip.show( main_mc.level1, "Safety", "We often work in harsh conditions and with potentially dangerous equipment. The first, last, and ongoing focus of all PRECorp activities is the safe work ethic employees." ); //this.traceDisplayList( stage ); } private function onMouseOver_test2_mc( event:MouseEvent ):void { _reusableTip.show( main_mc.test2_mc, "Hi", "Some Text" ); } // private function debug():void { // Memory Testing // _tf = new TextField() // addChild( _tf ); // this._timer = new Timer( 25 ); // this._timer.addEventListener( "timer", onTimer ); // this._timer.start(); // } // // private function onTimer( event:TimerEvent ):void { // _tf.text = flash.system.System.totalMemory.toString() // } // // function traceDisplayList(container:DisplayObjectContainer, indentString:String = ""):void{ // var child:DisplayObject; // for (var i:uint=0; i < container.numChildren; i++) // { // child = container.getChildAt(i); // trace(indentString, child, child.name); // if (container.getChildAt(i) is DisplayObjectContainer) // { // traceDisplayList(DisplayObjectContainer(child), indentString + " ") // } // } // } } } The error I get is: TypeError: Error #1009: Cannot access a property or method of a null object reference. at Application/initialize() at Application/loaderCompleteHandler() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/onComplete() thanks for your help, John
... View more