Solved

Flash Onrollover Function

Posted on 2004-09-16
3
573 Views
Last Modified: 2012-05-05
I am tring to get the text to change color on rollover.  However, the below function is not working as desired.  Ideally, I would like to loop through each movieclip to be able to create a rollover color for each.



for (i=0; i<3; i++) {
      _root.createEmptyMovieClip("menuName"+i, 600+i);
      eval("_root.menuName"+i).createTextField("recentBroadcast"+i+"_txt", 501+i, 435, 45+(i*17), 140, 20);
      eval("menuName"+i+".recentBroadcast"+i+"_txt").html = true;
      eval("menuName"+i+".recentBroadcast"+i+"_txt").htmlText = _"hello world";
      myFormat = new TextFormat();
      myFormat.color = 0x000000;
      myFormat.url = "www.yahoo.com";
      myFormat.font = "Arial";
      myFormat.bold = "true";
      eval("menuName"+i+".recentBroadcast"+i+"_txt").setTextFormat(myFormat);
}


this.menuName0.onRollover = function() {
      rollOverformat = new TextFormat();
      rollOverformat.color = 0xFFCE6C;
      this.recentBroadcast0_txt.setTextFormat(rollOverformat);
};





0
Comment
Question by:splendorx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
muso120999 earned 125 total points
ID: 12074689
Hi, I've changed your code slightly, as you are using i to create the text field name, as they are unique within a numbered movieclip this is unnecessary.  I added the rollOut too!

for (i=0; i<3; i++) {
      _root.createEmptyMovieClip("menuName"+i, 600+i);
      _root["menuName"+i].createTextField("recentBroadcast_txt", 501+i, 435, 45+(i*17), 140, 20);
      _root["menuName"+i].recentBroadcast_txt.html = true;
      _root["menuName"+i].recentBroadcast_txt.htmlText = "hello world";
      myFormat = new TextFormat();
      myFormat.color = 0x000000;
      myFormat.url = "www.yahoo.com";
      myFormat.font = "Arial";
      myFormat.bold = "true";
      _root["menuName"+i].recentBroadcast_txt.setTextFormat(myFormat);
      _root["menuName"+i].onRollOver = function() {
            rollOverformat = new TextFormat();
            rollOverformat.color = 0xFFCE6C;
            this.recentBroadcast_txt.setTextFormat(rollOverformat);
      };
      _root["menuName"+i].onRollOut = function() {
            rollOverformat = new TextFormat();
            rollOverformat.color = 0x000000;
            this.recentBroadcast_txt.setTextFormat(rollOverformat);
      };
}
0
 
LVL 10

Expert Comment

by:muso120999
ID: 12074786
By the way, there isn't any particular reason that I took out the eval's other than I find it easier to read
0
 
LVL 1

Author Comment

by:splendorx
ID: 12074802
Again, Thanks for the help Muso!!!  Great work!
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to disable  HTML5 video in chrome 2 1,598
Begin mp4 video on first frame 6 193
how can flash builder 4.X version make use of java 8 5 428
flash professional 3 43
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question