Web Hosting Forum | Lunarpages
News: July 14, 2008 - New Contest! - Submit Your WordPress Theme Designs, Win BIG!
September 1, 2008 - Submit Your Web Site for the Sept 2008 Site of the Month!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 08, 2008, 09:43:35 AM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: Using movie clip as button  (Read 1146 times)
soundkraft
Pong! (the videogame) Master
*****
Offline Offline

Posts: 27


WWW
« on: October 19, 2006, 11:29:43 AM »

Help
I am using a movie clip as a button and just have one problem.
the dynamic text i am using is longer than the button, so i need to put it into two lines. I cant seem to find the right code to insert in the actions layer. Thanks ahead of time. Here is the example

b1.onRollOver = over;
b1.onRollOut = out;
b1.butText.buttonText.text = "This is what i need to split into two lines";

function over() {
   this.gotoAndPlay(2);
}

function out() {
   this.gotoAndPlay(7);

}
Logged
philvis
Master Jedi
*****
Offline Offline

Posts: 1065


« Reply #1 on: October 19, 2006, 11:54:28 AM »

This might do it. You might need to set the width of the textbox to fit within the confines of the button too.
Code:
b1.butText.buttonText.wordWrap = true;
b1.butText.buttonText.multiline = true;
Logged

soundkraft
Pong! (the videogame) Master
*****
Offline Offline

Posts: 27


WWW
« Reply #2 on: October 19, 2006, 12:00:12 PM »

Thank You for the quick reply. Maybe you could help me with that i am a noob to flash.
The button will be 130w x 40h Font arial 12
Thanks again
« Last Edit: October 19, 2006, 12:09:16 PM by soundkraft » Logged
philvis
Master Jedi
*****
Offline Offline

Posts: 1065


« Reply #3 on: October 19, 2006, 12:36:55 PM »

You can create the textfield and set many of its parameters with one line of code:
Code:
this.createTextField("my_txt", 1, 100, 100, 300, 100);
The code above creates a text field named my_txt with a depth of 1, x coord of 1, y coord of 100, width of 300px and height of 100px. It would be a dynamic text field by default.
The code below should help in this case.
Code:
b1.butText.buttonText._width=130;
b1.butText.buttonText._height=40;
b1.butText.buttonText.font=arial;
Size 12 font is the default.
Logged

soundkraft
Pong! (the videogame) Master
*****
Offline Offline

Posts: 27


WWW
« Reply #4 on: October 19, 2006, 02:04:12 PM »

Thanks again for your  Help
Logged
soundkraft
Pong! (the videogame) Master
*****
Offline Offline

Posts: 27


WWW
« Reply #5 on: November 14, 2006, 01:08:34 PM »

Just one more question, could someone provide me with the right code to insert for line spacing. When i use this code the space between the two lines is way to much.

b1.buttText.buttonText._width=130;
b1.buttText.buttonText._height=40;
b1.buttText.buttonText.font=arial;
b1.buttText.buttonText.wordWrap = true;
b1.buttText.buttonText.multiline = true;
b1.onRollOver = over;
b1.onRollOut = out;
b1.buttText.buttonText.text = "Sample and         Quote Request";

Thanks
Logged
philvis
Master Jedi
*****
Offline Offline

Posts: 1065


« Reply #6 on: November 14, 2006, 01:18:41 PM »

Code:
b1.buttText.buttonText.leading= value;

The value is measured in pixels. 0 is the default value. Negative values lessen the vertical space and positive values increase it.
Flash Player 8 and above supports negative leading.
Logged

soundkraft
Pong! (the videogame) Master
*****
Offline Offline

Posts: 27


WWW
« Reply #7 on: November 14, 2006, 01:31:12 PM »

I would just like to say thank you for all your help philvis.
But the code has no effect on the text
Logged
philvis
Master Jedi
*****
Offline Offline

Posts: 1065


« Reply #8 on: November 14, 2006, 01:36:04 PM »

You're welcome. Check leading in Flash help under ActionScript for more hints.
Logged

philvis
Master Jedi
*****
Offline Offline

Posts: 1065


« Reply #9 on: November 15, 2006, 06:15:59 AM »

This should work for you if you haven't got it yet:
Code:
var my_scrunchedTxt:TextFormat = new TextFormat();
my_scrunchedTxt.leading = -10;
b1.buttText.buttonText.setTextFormat(my_scrunchedTxt);
Logged

soundkraft
Pong! (the videogame) Master
*****
Offline Offline

Posts: 27


WWW
« Reply #10 on: November 22, 2006, 05:10:20 AM »

No that didn't work  Crying or Very sad
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM