July 13th, 2011, 04:19 PM
Clicked text if statement
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
else If clicked.text in menubar = "Links" then
I am a vb.net programmer not flash any help would be great on both questions
July 14th, 2011, 05:23 AM
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:
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?
July 14th, 2011, 09:43 AM
Tann, why have you chosen to convert it into a sprite? Why not just a button symbol?
Originally Posted by Tann San
July 14th, 2011, 10:56 AM
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?