Can somebody please tell me how is this implemented:
- When a button is rolled over I display a movieclip
- When I rollout of button this movieclip stays on the screen
- When I click anywhere on the screen this movieclip then goes off
I have this sample ready, but no source. Can somebody please explain me the basics to implement such kind of functionality.
What you want is not clear to me. Are you want the code of how this is happen? or you just want to know in which situation this functionality should implement.
I kinda decompiled the .SWF file, and yeah ... he/she who made it, really used a simple solution -.-*
- Make a Movieclip, which will be visible/invisible when clicked on the button
- Give that Movieclip an instance name of, e.g.: my_mc
- Make a button, and give it an instance name of e.g.: my_btn
- Make a new layer, and drag it BELOW the layer with all of our content (the movieclip and the button)
- In that layer, create a LARGE button, covering the whole screen. Give it an instance name of: block_btn
- Now, on any Frame, put this code:
my_mc._visible = false; // make my_mc invisble at the start of movie
block_btn._alpha = 0; // make block_btn invisble, but still functional // in other words, change its alpha to 0
block_btn.useHandCursor = false; // prevent the Cursor/Mouse from changing // to Hand Cursor when you are on this button
my_btn.onRollOver = function(){ // on my_btn rollOver my_mc._visible = true; // make my_mc visible }
block_btn.onPress = function(){ // on block_btn clicked my_mc._visible = false; // make my_mc invisible }
In other words, they simply hid a Button beneath the Movieclip and Button, and prevented the Cursor from changing into a hand when on that button, and simply added some codes to it. However, I've simplified things by writing the whole code on a single Frame
Hope this Helps ya =)
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
Both the solutions of Marlopax and Nig_13 really helped. Thanks guys....wonderful job by you both....Nig_13, I also decompiled the SWF and found it to be implemented in the simplest way. Whereas, what Marlopax explained was the perfect technical way.
Thanks once again guys....and thanx to Arkitx for taking me into consideration!
One thing I must say that decompiling swf and expecting for right code and right structure is just not a right way to learn or grab someones skill.
Combinations of right code structure will always work. So a developer should focus on mechanism, which is his own creative process to make unique Application.
@ vinayak, I agree with arkitx, as your thread is posted on General Section, nobody guess in which version of AS code you are looking for. You also asking about implementation with a swf file which throws a sense that you are asking how to use this swf to your own projects with its own functionality and also implement your trigger action with it.
Oh yes! I forgot to mention the AS version. I was just curious to know how this functionality is implemented. I never wanted to extent or reuse it. I just wanted to know how wud you detect that mouse key is pressed somewhere out of the box.