• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

changing format of text - can't!!!

Contributor ,
May 27, 2009 May 27, 2009

Copy link to clipboard

Copied

I have a textField inside a mc. When you roll over an event is triggered.



In the fuction I can do this

Code:
event.currentTarget.getChildAt(0).text="fred";
and the text changes - so its being targetted



I want to change the format of the text so I thought

Code:
event.currentTarget.getChildAt(0).defaultTextFormat=mTitle_fmt;


but, its doesn't work.



it says "ReferenceError: Error #1037: Cannot assign to a method setTextFormat on flash.text.TextField.
at index001_fla::MainTimeline/overHandler()"



Any pointers please



thanks
TOPICS
ActionScript

Views

850

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 27, 2009 May 27, 2009

Copy link to clipboard

Copied

click file/publish settings/flash/permit debugging and retest.  using the line number in the error message confirm that error message references the line of code you displayed here.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 27, 2009 May 27, 2009

Copy link to clipboard

Copied

thanks for reply

the error code does apply to the red line in the code below

function createVideoLinks():void{
for (var i:int=0; i<externalXML.videoClip.length();i++){
//build the arrays of link text and link destination
trace (108+i*20);
vidText=externalXML.videoClip.vTitle;
vidLink=externalXML.videoClip.@vurl;

var linkHolder:MovieClip = new MovieClip();
var linkText:TextField = new TextField();
linkText.defaultTextFormat=lInact_fmt;
linkText.embedFonts=true;
linkText.antiAliasType=AntiAliasType.ADVANCED;
linkText.text=vidText;
linkText.height=19; linkText.autoSize=TextFieldAutoSize.LEFT;
addChild(linkHolder);
linkHolder.addChildAt(linkText,0);
linkHolder.x=1; linkHolder.y=(108+i*21);
linkHolder.buttonMode=true; //appears to give me back the correct cursor for links
linkHolder.ref=i;
linkHolder.mouseChildren = false;
linkHolder.addEventListener(MouseEvent.CLICK, clickHandler);
linkHolder.addEventListener(MouseEvent.MOUSE_OVER, overHandler);

}
}

function overHandler(event:MouseEvent):void {

trace(event.currentTarget.getChildAt(0));
event.currentTarget.getChildAt(0).setTextFormat=lRoll_fmt;

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 27, 2009 May 27, 2009

Copy link to clipboard

Copied

that makes more sense.

setTextFormat() is a method, not a property.  correct your syntax and recheck.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 27, 2009 May 27, 2009

Copy link to clipboard

Copied

D'OH

Thanks for the pointer - works now, of course - apologies for wasting your time!!!

Think I need a break

www.ee-web.co.uk

edward@ee-web.co.uk <mailto:edward@ee-web.co.uk07760>

07760 392284

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 27, 2009 May 27, 2009

Copy link to clipboard

Copied

LATEST

you're welcome.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines