Hello, in as2.0, how can i test the boolean value if a button was pressed or not? I have a simple function im trying to work with like this... button_btn.onRelease = function (success:Boolean) { if (success) { trace("we pressed the button - value is true"); } else { trace("value is false"); } }; working with booleans in this way is new to me - any pointers will do - thanks!
What is it that you are trying to accomplish? The onRelease method of buttons and movieclips fire every time the mouse releases a click over the button or mc. It does not get passed a boolean value like what you got there. If you are just trying to fire off some code every time the button is pressed and released, your code would look like this: button_btn.onRelease = function () { trace("we pressed the button"); }
I'm using NetStream.Play.Stop to invoke an action. when and only when it equals stop, I want the click_btn to seek the .flv back to 0 (i.e., mystream_ns.seek(0)). but if my infoObject.code does not equal NetStream.Play.Stop, then the click_btn should resume to its regular state, condition, etc....
Well, I'm not really that familiar with using video in flash, but from what I understand of what you are going for, these are my suggestions: If the code within your button has scope of the variable you are testing for: _global.myInfoObject; button_btn.onRelease = function(){ if( myInfoObject.code == (value your are testing for) ) { trace("value is correct); } else { trace ("value incorrect"); } if you aren't in scope you can always maybe forward the onRelease function to some handler that is in scope: var myInfoObject; var release = function(){ //to do code here; } button_btn.onRelease = release; I hope some of these ideas help a little. You can always send your .fla to my email at klinton@krksales.com and I'll take a look at it.
it'll be cool if there was something like this... click_btn.onRelease = function() { //condition 1.... if (stream_ns.time is equal to the full duration of the current .flv) { //condition 2....seek(0) } }
thanks k for the tips! I'll play around with that second strategy you mentioned and see if that gets me where I wanna be.
i got it! Here's a quick run down in an array format, hehe [0] crying... [1] create a boolean variable [2] create your switch case statements properly //which i didn't do... [3] condition your booleans in the case statements [4] then create your button handlers [5] if the boolean is true, then tell stream_ns.seek(0) [6] happy! thanks again K - have a great day.
Don't see what you're looking for? Try a search.
|