A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: [RESOLVED] [CS4] Help making AS2 code working on all Flash versions

  1. #1
    Member
    Join Date
    Oct 2006
    Posts
    48

    resolved [RESOLVED] [CS4] Help making AS2 code working on all Flash versions

    Hello

    I did this AS2 code in Flash CS4 and have a little trouble with it.

    Code:
    if (as2_mc.text != "Using Actionscript 2") {
    	_root.createEmptyMovieClip("dynamic_mc",1);
    	_root.dynamic_mc.beginFill(0x000000);
    	_root.dynamic_mc.moveTo(0,0);
    	_root.dynamic_mc.lineTo(Stage.width,0);
    	_root.dynamic_mc.lineTo(Stage.width,Stage.height);
    	_root.dynamic_mc.lineTo(0,Stage.height);
    	_root.dynamic_mc.lineTo(0,0);
    	_root.dynamic_mc.endFill();
    	_root.dynamic_mc._x = 0;
    	_root.dynamic_mc._y = 0;
    	_root.createTextField("dynamic_txt",2,0,0,150,1);
    	_root.dynamic_txt.text = "Not using Actionscript 2";
    	var textstyle:TextFormat = new TextFormat();
    	textstyle.color = 0xffffff;
    	textstyle.size = 16;
    	textstyle.font = "Arial";
    	textstyle.align = "center";
    	_root.dynamic_txt.setTextFormat(textstyle);
    	_root.dynamic_txt.autoSize = true;
    	_root.dynamic_txt.multiline = true;
    	_root.dynamic_txt.wordWrap = true;
    	_root.dynamic_txt._x = (Stage.width-_root.dynamic_txt._width)/2;
    	_root.dynamic_txt._y = (Stage.height-_root.dynamic_txt._height)/2;
    }
    It works like I want it to in Flash 7 and looks like this, but when I change the publish settings into Flash 8/9/10, the code looks like this.

    How do I make the code work on all AS2 Flash versions?
    Attached Files Attached Files
    Last edited by humbuged; 04-22-2009 at 12:10 PM.

  2. #2
    Member
    Join Date
    Oct 2006
    Posts
    48
    Your help would be much appreciated

  3. #3
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    Neither links work and i cant open you fla.
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  4. #4
    Member
    Join Date
    Oct 2006
    Posts
    48
    Here's a CS3 .fla file if you can't open the previous CS4 .fla file
    Attached Files Attached Files

  5. #5
    Member
    Join Date
    Oct 2006
    Posts
    48
    Anyone would care to help?

  6. #6
    Member
    Join Date
    Oct 2006
    Posts
    48
    Are you able to open the attached files? :O

  7. #7
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    Sorry bud been caught up with work stuff. Looking now
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  8. #8
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    Seems this issue is with you using multi line and centring your text.
    if you set to single line and left aligned it should work fine
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  9. #9
    Member
    Join Date
    Oct 2006
    Posts
    48
    You're right, I changed it from multiline to single line and it worked.

    Is there a way to make it work using multiline though?

    PS - I noticed if I substituted != with == when publish in F10, the code works. Isn't this reversed?
    Last edited by humbuged; 04-24-2009 at 05:11 AM.

  10. #10
    Member
    Join Date
    Oct 2006
    Posts
    48
    Ah, thanks for your help webdreamer! I set the text field to singleline. Then I added (as2_mc.wordWrap = true) on top so that the textfield fits into the box So now the code works on F7 thru F10 Thank you again!

  11. #11
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    Nice one
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

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