Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-12-2012, 12:49 AM   #1
Registered User
Join Date: Oct 2011
Posts: 9
Default flashvars question

I have a few projects going well for me as I work with this animal. But some of the fundamentals are escaping me and I admit I need work and help. If you could help me figure this out, I could apply it to a great gap in my knowledge I require for the small things I do in this script. I usually Google and get what I need, but it's failed me this time. Any help is appreciated.

ActionScript Code:
myTextField_txt.defaultTextFormat = new TextFormat("monotype", 16, 0x0CFF00, true);

This controls the output to the stage of my fetched text. It works great, but I would VERY much like to control this externally as well. The color for example. How would I call this in a flash variable to change the color externally? Is it possible with this code? Can you point me to an article that might show me the light? Much appreciation.

- Matt
Matthews1977 is offline   Reply With Quote
Old 02-12-2012, 01:26 AM   #2
Registered User
Join Date: May 2011
Posts: 33

I dont know if I fully understand you but this is a code that you can change the variable for the color of the text:

ActionScript Code:
var myColor = 0x0CFF00 var mySize = 16; var myFontType = "monotype"; myTextField_txt.defaultTextFormat = new TextFormat(myFontType, mySize , myColor, true);

This can allow you to change it later in your script.

Tell me if this is what you where looking for.
backshesh is offline   Reply With Quote
Old 02-12-2012, 01:52 AM   #3
Registered User
Join Date: Oct 2011
Posts: 9

It is, and in fact as you were probably typing that up I looked at a post regarding the loaderinfo and broke it down into varibles as you demonstrated, except I only wanted to change one. Then used the loaderinfo and a few other small routines to check for the varibles externally and replace them internally if present. It worked like a charm. Here is the new code for others.

I put in a default color. Then an IF statement to use the default if an external wasn't present. if one was, it will load that instead. the final product is 'myflashvars' and that contains the information parsed later. You can name it anything.

ActionScript Code:
var myflashvars:Object = new Object() var datcolor = "0xFFFFFF" if (!this.loaderInfo.parameters.datcolor){     myflashvars = datcolor; } else{     myflashvars = this.loaderInfo.parameters.datcolor; } myTextField_txt.defaultTextFormat = new TextFormat("monotype", 16, myflashvars, true);

And of course, it could be expanded upon to adjust all variables. Thank you for your time! Hopefully this helps someone else! Now on to figure out changing the color of the text tool additions externally.

- Matt

Last edited by Matthews1977; 02-12-2012 at 01:56 AM.
Matthews1977 is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 05:11 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.