Did you notice the difference between identifier "letter" at variable
definition and "letters" at later references?

  Attila

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From:    Pedro Kostelec <[EMAIL PROTECTED]>
To:      [email protected] <[email protected]>
Date:    Sunday, July 8, 2007, 9:43:59 PM
Subject: [Flashcoders] writing as for components
--====----====----====----====----====----====----====----====----====----===--
hello:

I've found a tutorial here:http://www.adobe.com/designcenter/video_workshop/
named writing ActionScript for Components. I have done all it wants me to do
it but i got the following errors:
1120: Access of undefined property letters.          var randomIndex:uint=
Math.floor(Math.random()*letters.length);
1120: Access of undefined property letters           return
letters[randomIndex];

Can anyone tell me what is wrong?

The code:

var letter:Array= ["A","B","C","D","E","F",
   "G","H","I","J","K","L",
   "M","N","O","P","Q","R",
   "S","T","U","V","W",
   "X","Y","Z",];
function getRandomLetter():String {
    var randomIndex:uint=Math.floor(Math.random()*letters.length);
    return letters[randomIndex];
}
import fl.controls.Button;

var i:uint=o;
var j:uint=0;
var posX:uint=o;
var posY:uint=0;
var buttonSize:uint=25;

while(posY<stage.stageHeight){
    posX=0;
    j=0;
    posY=i * buttonSize;

    while(posX<stage.stageWidth){
        posX= j * buttonSize;
        var b:Button= new Button
        b.setSize(buttonSize,buttonSize);
        b.move(posX, posY);
        b.label=getRandomLetter();
        addChild(b);
        j++;
    }
    i++;
}
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to