|
-
Can I send an object as an argument - custom properties?
Hi there, couple questions - keep in mind I have not used Flash since V4 , however I do have some expertise in JavaScript. So, I want a set of buttons that, when clicked, hold their "pressed" state until you click them once again. I need them to remember what state they are in, and communicate that to my HTML Form.
I was pointed to this example:
http://www.flashkit.com/board/showth...=active+button
(at the very bottom of the thread)
In which on his movie clip he has 2 frames, each with stop() on them. He seems to then call a function on press and pass the number of the button 1, 2 or 3. He then sets it to the down frame. He only has it working for one button at a time.
I need all buttons to be able to be on or off, not just one at a time. Were I to do this in JS, I would probably approach it like so.
For the button:
Code:
on(press){
selectButton(this);
}
Then the function
Code:
function selectButton(oButton)
{
newFrame = (oButton.<currentFrame> == 1) ? 2 : 1 ;
oButton.gotoAndPlay(newFrame);
oButton.status = newFrame; // which will be 1 or 2
}
Questions:
a) Can I send the symbol instance to the function as "this" - send itself as an object?
b) Once my function recieves that object (if it can), how would I reference what I am calling <currentFrame> in the above?
c) Does AS support the ternary operator like the first line in my function?
d) Does AS allow custom properties, like "status" which I set.
Am I on the right path or does AS not work this way? I was told they are close so I am hoping I can do some similar things.
Lastly, how would I then pass the 'status' of each button on form submit?
Thanks a bunch
Tom
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|