Solved

play movie event at click location cs3 flash

Posted on 2009-05-13
4
465 Views
Last Modified: 2013-11-11
New to flash,

I am creating a menu with buttons. The buttons will be linked to URL's with a second and a half delay for sound within the button located on the 'down' keyframe.

What I want is for a short (1 second) movie event to load, in the exact location of any click on any of the buttons in the menu. In other words, if the user clicks the upper left hand corner of the Contact Us button, I want my movie event to play in the upper left hand corner of the Contact Us button, a two second delay, and then redirect to a URL in the same window.

I am not even sure if I have been going about this the right way. I have created instances for the button and the movie event. I have been trying to insert in the first frame of an 'action script' layer, code that would direct the button to load the movie. Am I way off on the wrong track using combinations of the following commands (where btn is my button, and gunshot is my movie event):  
btn.addEventListener(onPress, gunshot.addASCuePoint);
onRelease.findCuePoint (gunshot);
gunshot.play
0
Comment
Question by:shemp609
  • 2
  • 2
4 Comments
 
LVL 22

Expert Comment

by:rascalpants
ID: 24379675

well you are using AS 3.0, but a bit wrong...

try the below instead...


and I am just assuming the following from the way you have it written..

- you have a function called findCuePoint, and you pass in the MovieClip "gunshot"
- gunshot has a function inside of it called "addASCuePoint" and it is called on click
- then you want the gunshot movieclip to play from the keyframe of where it is currently located

if any of this is wrong, then please explain a little better as to what you are trying to do...

and just an FYI... don't use buttons... only use movieclips, and controll everything with code from there...



rp / ZA






import flash.events.*;
 

btn.addEventListener( MouseEvent.CLICK, btn_OnClick);
 

function btn_OnClick( evt:MouseEvent ):void

{

  findCuePoint( gunshot );

  gunshot.addASCuePoint();

  gunshot.play();

}

Open in new window

0
 

Author Comment

by:shemp609
ID: 24401095
rascal-
thank you.
After a lot of trial and error I got the movie clip to load using the following script where cycle is my button, and gunshot is the movieclip that i want to load when the button is clicked:

cycle.onPress = function(){
            _root.attachMovie(gunshot, gunshot, _root.getNextHighestDepth());
            gunshot._x = 358;
            gunshot._y = 103;
            gunshot.play ();
            getURL("javascript:gunFire('http://**************.html')");
}

there are two things I still need to figure out:
1) I currently have the getURL directed to a javascript which creates a 2 second delay to allow for the gunshot movieclip to complete and then allows the page to redirect to the new URL associated with the cycle button.
I would like to use 'getURL("http*******", "_self", "GET") but I cannot figure out how to incorporate a 2 second delay in the actionscript 2 above.

2) I currently have X,Y cooridnates for the placement of the movieclip, gunshot. I would prefer for these coordinates to be generated by the location of the mouse-click. My best guess was to use the trace command, but it did not work:
gunshot._x = trace("X:"+cursor_mc._x);
gunshot._y = trace("Y:"+cursor_mc._y);

Any ideas on either of those two points?

Thanks!

0
 
LVL 22

Accepted Solution

by:
rascalpants earned 500 total points
ID: 24401381

for the delay...

you can setup a function that gets run after a setInterval()...  something like the below...

I wasn't able to get it tested, but it should work for you...


for the mouse coordinates...  use this instead....

gunshot._x = _xmouse;
gunshot._y = _ymouse;


BTW...  trace(); is used to just show data in the output panel.

rp / ZA





function callGetUrl( clip:MovieClip )

{

    clearInterval( clip.intID );

    getURL("javascript:gunFire('http://**************.html')");

}
 

cycle.onPress = function(){

            _root.attachMovie(gunshot, gunshot, _root.getNextHighestDepth());

            gunshot._x = 358;

            gunshot._y = 103;

            gunshot.play ();

            cycle.intID = setInterval( callGetUrl, 2000, cycle );

}

Open in new window

0
 

Author Comment

by:shemp609
ID: 24401515
Rascal P-
Youre the man!
Thank you. That works like a charm. I was so close but sometimes you just have to see it!

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How to put actionscript code for a button? 6 97
Embedded Video Download (Flash) 3 1,131
bandwidth 5 64
Actionscript in Flash 3 25
I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now