[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Swftools-common] object instantation?
From: |
Chris Flowers |
Subject: |
Re: [Swftools-common] object instantation? |
Date: |
Fri, 14 Jan 2005 05:39:18 -0500 |
----- Original Message -----
From: "Jesse Andrews" <address@hidden>
To: <address@hidden>
Sent: Friday, January 14, 2005 1:30 AM
Subject: [Swftools-common] object instantation?
> Hi, I am trying to build a simple quiz in swfc... My stumbling point
> thus far is how to create the buttons so they are not all the same
> object....
>
> My source:
>
> .flash name="quiz.swf" fps=50
>
> .box box1 color=white fill=#336633 width=50 height=50
> .box box2 color=white fill=#99cc99 width=100 height=100
>
> .font Arial filename="Arial.ttf"
> .text question font=Arial text="How many inchs in a foot?"
> .text a1 font=Arial text="6"
> .text a2 font=Arial text="12"
>
> .button mybutton1
> .show box1 as=shape x=25 y=25
> .show box2 as=hover x=0 y=0
> .on_press:
> this.geturl('javascript:alert(\'You are '+this.url+'\')');
> .end
> .end
>
> .frame 0
> .put question y=100 x=50
> .put b1=mybutton1 y=150
> .put a1 y=225 x=120
> .put b2=mybutton1 y=250 red=+255
> .put a2 y=325 x=120
> .action:
> a1.url = 'wrong';
> a2.url = 'right';
> .end
> .end
>
> Obviously b1,b2 are just names for the same object mybutton1. How
> should I go about having a button and creating copies of the button
> that will have their own "properties" or "attirbutes" or "members"
> (not sure what they are called in actionscript....)
>
> Thanks,
> Jesse
>
You can use actionscript on the frame where the button instances appear.
See below.
Chris
#
# Example Script
#
.flash bbox=320x240 fps=30 version=6 compress background=#CCCCCC
.box box1 70 32 color=black fill=blue
.box box2 70 32 color=black fill=red
.button mybutton1
.show box1 as=idle
.show box1 as=area
.show box2 as=pressed 1 1
.show box2 as=hover
.end
.frame 1
.put b1=mybutton1 20 20
.put b2=mybutton1 100 20
.action:
//test functions
b1.onPress = function(){ this._y+=5; };
b2.onPress = function(){ this._y+=5; };
.end
.end