Solved

Flash Dynamic onRollOver Function

Posted on 2008-10-07
3
204 Views
Last Modified: 2013-11-11
I am trying to rewrite a section of code using a for loop. It's a onRollOver function that is repeated 31 times.

The following code works:

_root.d1.onRollOver = function() {
      if (_root.vm1 != "M" && _root.ve1 == "E") {
            gotoAndStop(10);
            _root.xLeft = 0;
            _root.e_Info._x = 29.4;
            _root.downArrow._x = 286.1;
            _root.showTitleE = _root.ne1;
            _root.showWhenE = _root.we1;
            _root.showTimeE = _root.te1;
            _root.showLinkE = _root.le1;
      }
      if (_root.vm1 == "M" && _root.ve1 != "E") {
            gotoAndStop(15);
            _root.xLeft = 0;
            _root.m_Info._x = 29.4;
            _root.downArrow._x = 286.1;
            _root.showTitleM = _root.nm1;
            _root.showWhenM = _root.wm1;
            _root.showTimeM = _root.tm1;
            _root.showLinkM = _root.lm1;
      }
      if (_root.vm1 == "M" && _root.ve1 == "E") {
            gotoAndStop(20);
            _root.xLeft = 0;
            _root.b_InfoTop._x = 29.4;
            _root.b_InfoBottom._x = 29.4;
            _root.downArrow._x = 286.1;
            _root.showTitleE = _root.ne1;
            _root.showWhenE = _root.we1;
            _root.showTimeE = _root.te1;
            _root.showLinkE = _root.le1;
            _root.showTitleM = _root.nm1;
            _root.showWhenM = _root.wm1;
            _root.showTimeM = _root.tm1;
            _root.showLinkM = _root.lm1;
      }
}

_root.d2.onRollOver = function() {
      if (_root.vm2 != "M" && _root.ve2 == "E") {
            gotoAndStop(10);
            _root.xVal = 17.5;
            _root.e_Info._x = 46.9;
            _root.downArrow._x = 308.1;
            _root.showTitleE = _root.ne2;
            _root.showWhenE = _root.we2;
            _root.showTimeE = _root.te2;
            _root.showLinkE = _root.le2;
      }
      if (_root.vm2 == "M" && _root.ve2 != "E") {
            gotoAndStop(15);
            _root.xVal = 17.5;
            _root.m_Info._x = 46.9;
            _root.downArrow._x = 308.1;
            _root.showTitleM = _root.nm2;
            _root.showWhenM = _root.wm2;
            _root.showTimeM = _root.tm2;
            _root.showLinkM = _root.lm2;
      }
      if (_root.vm2 == "M" && _root.ve2 == "E") {
            gotoAndStop(20);
            _root.xVal = 17.5;
            _root.b_InfoTop._x = 46.9;
            _root.b_InfoBottom._x = 46.9;
            _root.downArrow._x = 308.1;
            _root.showTitleE = _root.ne2;
            _root.showWhenE = _root.we2;
            _root.showTimeE = _root.te2;
            _root.showLinkE = _root.le2;
            _root.showTitleM = _root.nm2;
            _root.showWhenM = _root.wm2;
            _root.showTimeM = _root.tm2;
            _root.showLinkM = _root.lm2;
      }
}


But I need this for 31 instances; I tried this, but it doesn't work:

for (x = 1; x < 32; x++) {
      _root["d"+x].onRollOver = function() {
            if (_root["vm"+x]!= "M" && _root["ve"+x] == "E") {
                  gotoAndStop(10);
                  _root.xLeft = 0;
                  _root.e_Info._x = 29.4 + (17.5*(x-1));
                  _root.downArrow._x = 286.1 + (22*(x-1));
                  _root.showTitleE = _root["ne"+x];
                  _root.showWhenE = _root["we"+x];
                  _root.showTimeE = _root["te"+x];
                  _root.showLinkE = _root["le"+x];
            }
            if (_root["vm"+x] == "M" && _root["ve"+x] != "E") {
                  gotoAndStop(15);
                  _root.xLeft = 0;
                  _root.m_Info._x = 29.4 + (17.5*(x-1));
                  _root.downArrow._x = 286.1 + (22*(x-1));
                  _root.showTitleM = _root["nm"+x];
                  _root.showWhenM = _root["wm"+x];
                  _root.showTimeM = _root["tm"+x];
                  _root.showLinkM = _root["lm"+x];
            }
            if (_root["vm"+x] == "M" && _root["ve"+x] == "E") {
                  gotoAndStop(20);
                  _root.xLeft = 0;
                  _root.b_InfoTop._x = 29.4 + (17.5*(x-1));
                  _root.b_InfoBottom._x = 29.4 + (17.5*(x-1));
                  _root.downArrow._x = 286.1 + (22*(x-1));
                  _root.showTitleE = _root["ne"+x];
                  _root.showWhenE = _root["we"+x];
                  _root.showTimeE = _root["te"+x];
                  _root.showLinkE = _root["le"+x];
                  _root.showTitleM = _root["nm"+x];
                  _root.showWhenM = _root["wm"+x];
                  _root.showTimeM = _root["tm"+x];
                  _root.showLinkM = _root["lm"+x];
            }
      }
}

Any and all help is greatly appreciated.
0
Comment
Question by:kenfx
[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 39

Expert Comment

by:blue-genie
ID: 22719348
hi, can you zip up your file and upload.
add a .txt extention to .fla extension.
0
 

Accepted Solution

by:
kenfx earned 0 total points
ID: 22986492
My apologies...please close this question as the project went away and the person I was asking the question for went away as well.

Thanks.
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 22991828
you need to close it yourself. click request attention.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

752 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