I have a sprite inside a sprite. This sprite also contains a text filed. The path FL spits out is as follows:
Movieclip: Bild=0 Ziel="_level0.captions.captionLine_32"
Text bearbeiten: Ziel="_level0.captions.captionLine_32.captionText" Variable= Sichtbar=true Text = <P ALIGN=“RIGHT”><FONT FACE=“BodyTextFont” SIZE=“8” COLOR="#000000" LETTERSPACIN
G=“0” KERNING=“0”>captionLine_32</FONT></P>"
captions.getChildByName(“captionLine_32”).alpha=0
works like charm. The sprite will turn invisible. But if I want to address the text filed and change its content I don’t have any luck. Usually I did use eval() in the good old days to get to the text field. Never a problem. But thanks to ADOBE this doesn’t work anymore.
How do I need to alter the addressing to change the text?
I thought it would need to look like
captions.getChildByName(“captionLine_32”).captionText.text=“Changed!” or
captions.getChildByName(“captionLine_32”).getChildByName(captionText).text=“Changed!”.
But nothing works so far. I’m stuck
My text.as looks like that:
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.AntiAliasType;
public class BodyText extends Sprite {
[Embed(systemFont="hooge 05_53",fontWeight="normal",fontName="BodyTextFont",mimeType="application/x-font")]
public static var hoogeBody:Class;
//
//--------variables--------
private var txt:TextField;
private var textFormatPassive:TextFormat;
private var textFormatActive:TextFormat;
private var colorPassive:int;
private var colorActive:int;
private var buttonPosX:int;
private var buttonPosY:int;
private var buttonSizeX:int;
private var buttonSizeY:int;
private var zoomFactor:Number;
private var chosenImage:Object;
private var imageCaptions:Array;
//
//sicherungs-slots für zentrierung bei vergrößerung
private var sizeX:Number;
private var sizeY:Number;
//
//--------menu text button--------
public function BodyText(cP:uint,cA:uint,label:String,xP:uint,yP:uint,xS:uint,yS:uint, cI:Object ,iC:Array ):void {
//
//--------position and size--------
colorPassive=cP;
colorActive=cA;
buttonPosX=xP;
buttonPosY=yP;
buttonSizeX=xS;
buttonSizeY=yS;
zoomFactor=1.12;
chosenImage=cI;
imageCaptions=iC;
//
//--------text format--------
textFormatPassive=new TextFormat ;
textFormatPassive.font="BodyTextFont";
textFormatPassive.bold=false;
textFormatPassive.color=colorPassive;
textFormatPassive.size=08;
textFormatPassive.align="right";
//
//--------text format--------
textFormatActive=new TextFormat ;
textFormatActive.font="BodyTextFont";
textFormatActive.bold=false;
textFormatActive.color=colorActive;
textFormatActive.size=08;
textFormatActive.align="right";
//
//--------text field--------
txt = new TextField();
txt.embedFonts=true;
txt.antiAliasType=AntiAliasType.NORMAL;
txt.text=label;
txt.setTextFormat( textFormatPassive );
txt.selectable=false;
txt.width=buttonSizeX;
txt.height=buttonSizeY;
txt.x=buttonPosX;
txt.y=buttonPosY-2;
//
//--------background of button--------
graphics.beginFill(0xffffff,1);
graphics.drawRect(buttonPosX, buttonPosY, buttonSizeX, buttonSizeY);
graphics.endFill();
//
//--------aktuelle größe und offsets sichern für zentrierung bei vergrößerung--------
sizeX=this.width;
sizeY=this.height;
//
//--------zur anzeigeliste hinzufügen--------
addChild( txt );
txt.name="captionText";
}
}
}
HEEEEEELLP!