play movie event at click location cs3 flash

Posted on 2009-05-13
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);
Question by:shemp609
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 22

Expert Comment

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

btn.addEventListener( MouseEvent.CLICK, btn_OnClick);
function btn_OnClick( evt:MouseEvent ):void
  findCuePoint( gunshot );

Open in new window


Author Comment

ID: 24401095
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;

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?


LVL 22

Accepted Solution

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 );
cycle.onPress = function(){
            _root.attachMovie(gunshot, gunshot, _root.getNextHighestDepth());
            gunshot._x = 358;
            gunshot._y = 103;
            cycle.intID = setInterval( callGetUrl, 2000, cycle );

Open in new window


Author Comment

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!


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to convert pdf file to html file 8 419
Failed download 57 592
Virus or Outlook 2007 problem, how to tell? 8 94
Can not play videos on in Chrome 13 156
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

734 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