i know this is all over the forums everywhere but i cannot find my answer anywhere! so i did my entire website in as 2.0 and i would like to upgrage, but as 3.0 is driving me crazy. ive been googling for 3 days. i hope someone can help.
so i have my gallery.fla and my document class named gallery and i have another class called buttons which i would like to add several buttons with a loop from an xml file, where the xml places a name inside a text box that is inside a movie clip linkage name button, but base class name buttons. so im just testing it and i add my button to the stage and then try to place text inside the dynamic text box, but i keep getting the 1120:Access to unidentified property btn for the line btn.btnName_txt = “testing” but i just added this object to the stage??? i even wrapped it inside of an event listener to make sure that the movieclip was on the stage. still the same thing. AND if i write btn.btnName_txt.text = “testing” i get: TypeError: Error #1009: Cannot access a property or method of a null object reference.at gallery$iinit(). but i get no compiler error…this is from the output window. here is my code:
gallery.as
package
{
import caurina.transitions.*;
import Thumbnail;
import flash.xml.*;
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.text.*;
import flash.events.*;
import buttons;
public class gallery extends MovieClip
{
public function gallery()
{
var btnName:String;
var btn:buttons = new buttons();
addChild(btn);
btn.x = 100;
btn.y = 100;
btn.btnName_txt = "testing";
}
}
}
buttons.as:
package
{
import caurina.transitions.*;
import flash.xml.*;
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.text.*;
import flash.events.*;
public class buttons extends MovieClip
{
public function buttons()
{
this.buttonMode = true;
this.addEventListener(MouseEvent.CLICK, showGalBtns)
}
function showGalBtns(event:MouseEvent):void
{
trace("this btn works");
}
}
}
and the movie clip im trying to add is linkage name button with base class buttons and the dynamic text box inside of it is instance name btnName_txt.
thanks so much for reading all of this…