Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 850
  • Last Modified:

as3 Flash: dynamic gradient text

i want to make dynamic gradient text in my flash swf.

the way i have been playing with is this:
i create two layers on my time line
the top layer has a static text textbox on it
on the bottom layer i have a gradient box

in the text box i type some letters-  then i right click on the layer with the textbox and select mask
This produces the desired effect.
now the problem…
 i want to dynamically add text to this text box.
to do so i have to switch the text box type to dynamic and in my code i
set my textbox.text = "mytext";

the result is not consistent.
I’ve tried other thing like applying the mask in code. I’ve tried cacheAsBitmat for both my textfield and the gradient box and setting the mask gradiantbox.mask = textfield which also doesn’t work for me. I’ve also tried adding the textbox through code.
 every way that i have tried i get inconsistent results. sometime the text seems to disappear! sometimes the mask does not apply. what the heck am i doing wrong?!  : )
any help would be appreciated.

Thanks : )


0
conagraman
Asked:
conagraman
  • 3
1 Solution
 
dgofmanCommented:
Please can you create a sample FLA file in CS4 format and attach to your post
0
 
conagramanAuthor Commented:
Thank you for the comment.
I was able to get it. i really don’t know what it is that I was doing wrong. I built a file to build myself examples. I’m sure you don’t need it dgofman but I am posting it for anyone who might need it in the future. The file gives three examples. You can see my progression with the three examples.
The first example is a text box and a gradient box in a movie clip.
The second has the textbox in a movie clip and the gradient is in a movie clip.
The third is a movie clip that contains a movie clip with a gradient box and a textbox.
The third one is the one that I really was trying to create. The purpose was to be able to not have to add the objects at runtime and to be able to not have to add the filters at runtime.

Thanks again for the comment dgofman
 textGradient4.fla
textGradient4.swf
0
 
conagramanAuthor Commented:
that last swf was the wrong one here is the right swf textGradient4.swf
0
 
conagramanAuthor Commented:
adding for future users
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now