Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-23-2006, 06:01 AM   #1
Incrue
the ever-living
 
Incrue's Avatar
 
Join Date: Jan 2006
Location: inside this plane
Posts: 113
Send a message via MSN to Incrue
Default hiTest and variables

I dont know how advanced or newbie is this, so i am asking here
I want a movieClip to have a Array of other movieClips and hitTest all of them each frame,and if hits run a function callad onHit+nameOfClipHited
I also wanted, for example, inside the array the names are "dog", "cat", but when call a function it would be like "onHitDog" "onHitCat" , i mean, with uppercase
This seems so simple and i cant figure it how to do it
the code:
PHP Code:
var clipsToHitTest:Array;
clipsToHitTest[3] = "dog";
clipsToHitTest[2] = "cat";
clipsToHitTest[1] = "mouse";
clipsToHitTest[0] = "keyboard";
this.onEnterFrame = function(){
    var 
cth clipsToHitTest[3];
    
//trace( cth);
if ( this.hitTestthis._parent[cth])  ) {
 var 
nae:String clipsToHitTest[3];
 var 
firstLetter:String =  nae.charAt(0);
 var 
firstLetterUp:String firstLetter.toUpperCase(); 
 
 
 var 
lastChar:Number nae.length;
 var 
mySubstring:String nae.substring(2,lastChar);
 var 
allth:String =firstLetterUp mySubstring;

 var 
nameFunc:String ="onHit" allth;
 
trace(nameFunc);
 
this[nameFunc];
    }

Incrue 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 06:32 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.