A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Dynamic function

  1. #1
    Junior Member
    Join Date
    Jun 2002
    Posts
    1

    Dynamic function

    I'm having trouble making this function dynamic. I've done similar code before, why doesn't this work?

    Code:
    function makeSmall(){
    	for(i=1;i<=samples.length;i++){
    		with(windows){
    			this["w"+i].winOff();
    			trace(this["w"+i]);
    		}
    	}
    	//windows.w1.winOff();
    	//windows.w2.winOff();
    	//windows.w3.winOff();
    	//windows.w4.winOff();
    	//windows.w5.winOff();
    	//windows.w6.winOff();
    	//windows.w7.winOff();
    	//windows.w8.winOff();
    }

  2. #2
    ·»¤«· >flashl!ght<'s Avatar
    Join Date
    Jun 2003
    Posts
    746
    What does the trace() output? Copy/paste the entire output window.

    From looking at the code, it looks good, only the samples array reference makes me wonder... are you sure that is the correct scope? Did you try trace(samples) and trace(samples.length) to double check that? Also, I'm not fond of the with() command, I would have just done:
    code:

    function makeSmall(){
    for(i=1;i<=samples.length;i++){
    windows["w"+i].winOff();
    trace(windows["w"+i]);
    }
    }

    >flashl!ght<
    All the normal names were taken.
    Ron Paul was right.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center