#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2011
    Posts
    2
    Rep Power
    0

    Clicked text if statement


    Hello

    I have an issue with a web gallery that i am building and i was hoping for some help?

    1. I have a stage and I add some title text to my stage and align it right and height centered
    Im preview it looks fine but when i publish its in the center of the screen

    2. I have menu items that are loaded from a XML file. I have added two test lines to this file that get added to the menu

    one text displays as "Contact me" and another called "Links"

    when this text is click I want to activate a Links movieclip/ wepart and a Contact for the other.

    I see the logic something like
    If clicked.text in menubar = "Contact Me" then
    run contactform
    else If clicked.text in menubar = "Links" then
    run Linksform
    End if

    I am a vb.net programmer not flash any help would be great on both questions

    thanks

    Alan
  2. #2
  3. No Profile Picture
    Gotta get to the next screen..
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2003
    Location
    Legion of Dynamic Discord
    Posts
    6,678
    Rep Power
    3165
    Hi, the text problem could be caused by the font or more specifically, not embedding the font. Embedding the font is easy and quick:
    • Select the TextField on the stage and open the properties panel.
    • Near to where you specify the font to use is a button labelled "Embed..."
    • Click that to open the font embedding window.
    • Give it a name, pick the font family and style. When it comes to character ranges, this is where you can say "I only want to include the numbers 0-9" or "I want all lowercase letters" and so on. Tick the relevant boxes. For simple testing it is sometimes easier to just tick All. Just remember to narrow that down before going live.
    • Now click on the ActionScript tab of the font embedding window. Tick the "Export for ActionScript" and "Export in frame 1" boxes. I always do my Outline format as Classic (DF3).
    • When you click OK now it will probably prompt you about a missing class file. It will also say that it will create one for you automatically. I actually make my own class files for embedded fonts just to avoid this message ^_^

    That's it, you have now embedded the font. When you select the TextField and look at the font name it will now have a star next to it i.e. Ariel * which means that the font is embedded. Now find any other TextFields you have and do the same with them.

    You don't have to embed the same font for each TextField, once you've embedded it once you can just pick the font from the drop down list, just pick the one with the * next to it.

    You only have to do all that with Dynamic or Input textfields. Static textfields work differently.

    For making the text into buttons, you should create a transparent rectangle over the text to server as a hit area. Convert each rectangle+text into a Sprite and give the instance on the stage an instance name. You will need to use mouse event listeners to make them act like buttons:
    Code:
    import flash.event.MouseEvent;
    
    your_button_instance_name.addEventListener(MouseEvent.CLICK, this.doClick);
    
    function doClick(event:MouseEvent):void
       {
          this.gotoAndPlay("Contact Me");
       }
    You have gotoAndPlay and gotoAndStop, look them up in the ActionScript reference docs. Also look up "ActionScript 3 Frame Label" which will help you give labels to particular frames which you can then gotoAndPlay or gotoAndStop.
    Quis custodiet ipsos custodes?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    660
    Rep Power
    32
    Tann, why have you chosen to convert it into a sprite? Why not just a button symbol?
    Originally Posted by Tann San
    Hi, the text problem could be caused by the font or more specifically, not embedding the font. Embedding the font is easy and quick:
    • Select the TextField on the stage and open the properties panel.
    • Near to where you specify the font to use is a button labelled "Embed..."
    • Click that to open the font embedding window.
    • Give it a name, pick the font family and style. When it comes to character ranges, this is where you can say "I only want to include the numbers 0-9" or "I want all lowercase letters" and so on. Tick the relevant boxes. For simple testing it is sometimes easier to just tick All. Just remember to narrow that down before going live.
    • Now click on the ActionScript tab of the font embedding window. Tick the "Export for ActionScript" and "Export in frame 1" boxes. I always do my Outline format as Classic (DF3).
    • When you click OK now it will probably prompt you about a missing class file. It will also say that it will create one for you automatically. I actually make my own class files for embedded fonts just to avoid this message ^_^

    That's it, you have now embedded the font. When you select the TextField and look at the font name it will now have a star next to it i.e. Ariel * which means that the font is embedded. Now find any other TextFields you have and do the same with them.

    You don't have to embed the same font for each TextField, once you've embedded it once you can just pick the font from the drop down list, just pick the one with the * next to it.

    You only have to do all that with Dynamic or Input textfields. Static textfields work differently.

    For making the text into buttons, you should create a transparent rectangle over the text to server as a hit area. Convert each rectangle+text into a Sprite and give the instance on the stage an instance name. You will need to use mouse event listeners to make them act like buttons:
    Code:
    import flash.event.MouseEvent;
    
    your_button_instance_name.addEventListener(MouseEvent.CLICK, this.doClick);
    
    function doClick(event:MouseEvent):void
       {
          this.gotoAndPlay("Contact Me");
       }
    You have gotoAndPlay and gotoAndStop, look them up in the ActionScript reference docs. Also look up "ActionScript 3 Frame Label" which will help you give labels to particular frames which you can then gotoAndPlay or gotoAndStop.
  6. #4
  7. No Profile Picture
    Gotta get to the next screen..
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2003
    Location
    Legion of Dynamic Discord
    Posts
    6,678
    Rep Power
    3165
    A Sprite is a pretty low level object in the DisplayObject heirarchy, it's like one step above a Shape but one step below a full blown MovieClip. The Button class adds a bunch of extra stuff that isn't needed for such a simple text button.
    Quis custodiet ipsos custodes?

IMN logo majestic logo threadwatch logo seochat tools logo