A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Changing Dynamic text from function

  1. #1
    Senior Member
    Join Date
    Jul 2008
    Posts
    117

    Changing Dynamic text from function

    Hello,

    I'm trying to change the text in a dynamic text box (which itself I've created by createTextField through actionscript), and I'm trying to do it from within a function. However, I can't seem to do it!

    Basically, I've go this bit which creates the text box:


    _root.createTextField("mytext",105,125,428,300,100 );
    mytext.text = "TEXT DISPLAYED";

    myTextFormat = new TextFormat();
    myTextFormat.font = "Arial";
    myTextFormat.size = 11;
    myTextFormat.color = 0x999999;
    myTextFormat.align = "right";

    mytext.setTextFormat(myTextFormat);

    textInstance.setTextFormat(myTextFormat);




    and then later on I have a function which fades in an image when a button is pressed:



    buttons_mc4.four_mc.onRelease = function() {
    new Tween (container_mc,"_alpha",Strong.easeOut,100,0,20,fal se).onMotionFinished = function(){
    container_mc.loadMovie("../images/4.jpg");

    fadeIn();
    }
    }



    I tried putting this in to change the text in the dynamic text box but it didn't work:



    buttons_mc4.four_mc.onRelease = function() {
    new Tween (container_mc,"_alpha",Strong.easeOut,100,0,20,fal se).onMotionFinished = function(){
    container_mc.loadMovie("../images/4.jpg");

    fadeIn();
    }
    mytext.text = "TEXT DISPLAYED";
    }


    any ideas what I'm doing wrong?

    All suggestions greatly appreciated! Cheers.

  2. #2
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    try resetting the text format

    PHP Code:
    fadeIn();
    }
    mytext.text "TEXT DISPLAYED";
    textInstance.setTextFormat(myTextFormat);

    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

  3. #3
    Senior Member
    Join Date
    Jul 2008
    Posts
    117
    Thanks very much. It works! Cheers.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center