swftools-common
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Swftools-common] Really basic AS3 question


From: Richard Humphreys
Subject: [Swftools-common] Really basic AS3 question
Date: Fri, 16 Oct 2009 21:09:36 +0100
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

I am an experienced AS3 programmer, but having played with swfc for a few days I am struggling to accomplish even basic tasks.

First question, how does one add a sprite to the stage using script? I am well aware of how to use '.put ...', but for an arbitrary (and possibly large) number of objects I would naturally use addChild();.

The following test gives 'Couldn't resolve ...' and 'subclassing' warnings when compiling, then predictably produces no result from the actionscript - only, from the .put.

Is there some piece of documentation which I have not yet stumbled accross?

Many thanks,

Richard.


.flash filename="test.swf" bbox=200x200 version=9 fps=40 background=#404040
   .box b1 10 10 color=yellow
   .circle c1 r=15 color=red

   .sprite logo
       .put b1 x=-5 y=-5
       .put c1 x=-15 y=-15
   .end

   .frame 1

       # This works
       .put a=logo x=30 y=30

   # However this does not work...
   .action:
       var i:int, j:int;
       var o;

       j = Math.random()*10;
for(i=0; i<j; i++)
       {
           o = new logo();
           o.x = Math.random() * 10 * i;
           o.y = Math.random() * 10 * i;
           addChild(o);
       }
   .end
.end





reply via email to

[Prev in Thread] Current Thread [Next in Thread]