Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 06-03-2012, 09:22 AM   #1
nick.marshal
Registered User
 
Join Date: Oct 2010
Posts: 23
Default Map onrollover issue

Code:
var sname1 = "StateName1"; //but1
var sname2 = "StateName2";   //but2
for (var i:Number = 1; i<=2; i++) {
	this['but'+i].onRollOver = function (){
			trace(i);  //this i comes out to be 3 
			trace(this['sname'+i]);
			bubble_mc._visible = true;
			bubble_mc.text = this['sname'+i];
		}
		
	this['but'+i].onRollOut = function (){
			//trace(sname);
			bubble_mc.text = "";
			bubble_mc._visible = false;
		}	
}
The bubble_mc.text comes out to be undefined. Also the trace(i) is returning 3 on hover whereas it should give 1 or 2 right ? I am doing something wrong here as i have been out of practice for sometime. Please help.
nick.marshal is offline   Reply With Quote
Old 06-03-2012, 10:57 AM   #2
Prid
Prid - Outing
 
Prid's Avatar
 
Join Date: Oct 2009
Location: Halden, Norway
Posts: 1,157
Send a message via MSN to Prid Send a message via Skype™ to Prid
Default

Common issue, READ THIS

Solution:

ActionScript Code:
var sname1 = "StateName1"; //but1 var sname2 = "StateName2";   //but2 for (var i:Number = 1; i<=2; i++) {     btnClick(this['but'+i]); } function btnClick(btn){     btn.onRollOver = function (){             trace(i)//this i comes out to be 3             trace(this['sname'+i]);             bubble_mc._visible = true;             bubble_mc.text = this['sname'+i];         }             btn.onRollOut = function (){             //trace(sname);             bubble_mc.text = "";             bubble_mc._visible = false;         } }
__________________
17 Years old boy, who loves the Computer Technology
Prid is offline   Reply With Quote
Reply


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 Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:22 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2013, 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.