Join Login


Yahoo! Small Business
 Hover over Text to show video
 by cdolphin09 - Apr 13, 2011

Got another flash question for you.

I am making a 300x250 flash ad banner and basically what I need to do is this:
When the user hovers over some text, what should show is a countdown, 3,2,1 and then a video auto plays. When the mouse rolls off the countdown, the video will disappear.

My question is, how would the script go to have the video play when hovering over text?

If I have the right idea, the countdown part can be just a simple image gallery of 3, 2, 1 and then it loads the video.

Hope this makes sense. The countdown is needed because there are some graphic images within the video, so the user has enough time to exit out before the video plays.

Thanks!
Cristina


cdolphin09
United States
Posts:19
Joined:Mar 28, 2011
 RE: Hover over Text to show video
 by cdolphin09 - Apr 13, 2011

oh, by the way Im working on CS5 actionscript 2.0
Thanks!


cdolphin09
United States
Posts:19
Joined:Mar 28, 2011
 RE: Hover over Text to show video
 by RiverCityGraphix - Apr 13, 2011

AS2, well that throws a wrench in things lol. I can explain it to you, but I dont know all of the code for AS2 as I got into Flash at AS3.

I would assume that you would have 2 frames. 1 would hold your countdown which should be in its own movieclip with a number on each frame (coppied out for the length of 1 second). On the first frame of the countdown you will have a onrollover action that plays when rolled over. You will also have a onrollout function that will take you back to frame 1 if the user moves off of it. On the third image of the countdown you will need to have actions that gotoandplay the second frame on your main stage (holds the video).

That was kind of confusing, so if you have any questions, let me know.


Be sure to subscribe on YouTube.

Do you take great photos? Consider selling them on Dreamstime.
RiverCityGraphix
United States
Posts:327
Joined:Nov 21, 2009
 RE: Hover over Text to show video
 by cdolphin09 - Apr 13, 2011

Yea, I stuck with AS2 because I had a previous flash file in AS2 from another project that I inserted into this one, so I had to keep it all the same.
But I understand where you are going and I am going to play around with it given your suggestions. If I have any specific questions... I will let you know, which I'm sure I probably will :)


cdolphin09
United States
Posts:19
Joined:Mar 28, 2011
 RE: Hover over Text to show video
 by cdolphin09 - Apr 13, 2011

Ok, I have a question, lol.
How do you get a link to stop working at a certain frame?
I have this code: (but I want to stop its function at frame 120

hyperlink1.onRelease=function(){
getUrl("http://www.harpseals.org");
};



cdolphin09
United States
Posts:19
Joined:Mar 28, 2011
 RE: Hover over Text to show video
 by RiverCityGraphix - Apr 13, 2011

Hmm. There are probably a few ways to go about that. You either need to get rid of the link completely or get rid of te url I would assume.

To get rid of the link I think this would work:

hyperlink1.onRelease=function(){
if (this._currentframe <=119){
getUrl("http://www.harpseals.org");
}else {
getUrl("");

}


Or you could just make the hyperlink1 invisible with hyperlink1.visible = false. That would go on frame 120.


Be sure to subscribe on YouTube.

Do you take great photos? Consider selling them on Dreamstime.
RiverCityGraphix
United States
Posts:327
Joined:Nov 21, 2009
 RE: Hover over Text to show video
 by RiverCityGraphix - Apr 13, 2011

I think I forgot a space between <= and 119. That might mess it up so I just wanted to mention it.


Be sure to subscribe on YouTube.

Do you take great photos? Consider selling them on Dreamstime.
RiverCityGraphix
United States
Posts:327
Joined:Nov 21, 2009
 RE: Hover over Text to show video
 by cdolphin09 - Apr 13, 2011

Almost... it seems to be missing something. When the banner runs, it automatically opens that link, instead of just opening when the user clicks on the link. But that was a good start.. I will ponder this :)


cdolphin09
United States
Posts:19
Joined:Mar 28, 2011
 RE: Hover over Text to show video
 by RiverCityGraphix - Apr 13, 2011

Maybe you could put the whole thing in an if statement:

if (this._currentframe <=119){
hyperlink1.onRelease=function(){
getUrl("http://www.harpseals.org");
};
}



Be sure to subscribe on YouTube.

Do you take great photos? Consider selling them on Dreamstime.
RiverCityGraphix
United States
Posts:327
Joined:Nov 21, 2009
 RE: Hover over Text to show video
 by DVictor14 - Apr 13, 2011

may I give u a sugestion...
What exactly do u need from that old AS2 project?
if u need just a lil'bit you can copy it and just modify something the code(not a lot of work ;) ) and then add the banner in As3 because, in my opinion, it'll be batter and not a lot of work at the banner code

Have a good time!
Victor :)


DVictor14
Romania
Posts:55
Joined:Mar 15, 2011
 RE: Hover over Text to show video
 by DVictor14 - Apr 13, 2011

And RCG what u told her it's not confusing...it's logically :) i think that the countdown will work like a preLoader, isn't it?



DVictor14
Romania
Posts:55
Joined:Mar 15, 2011
 RE: Hover over Text to show video
 by cdolphin09 - Apr 14, 2011

Thank you for all your suggestions :) I actually got the countdown to work as a movie clip that was added into the over-state of my button. And it works pretty well.
I am still working on the code for the hyperlink, and hopefully will knock that one out today.
Thank you!


cdolphin09
United States
Posts:19
Joined:Mar 28, 2011
 RE: Hover over Text to show video
 by cdolphin09 - Apr 14, 2011

ohhhh my gosh! I just read over what you wrote and saw this part, "Or you could just make the hyperlink1 invisible with hyperlink1.visible = false. That would go on frame 120."

I feel so blind.

Well, this did the trick! lol

Sorry about that, I feel like a winner right now ;)

Thank you!!


cdolphin09
United States
Posts:19
Joined:Mar 28, 2011
 RE: Hover over Text to show video
 by cdolphin09 - Apr 17, 2011

Hey Kevin,

I decided to put this project into AS3, sooooo over AS2 lol

You previously commented above on my project:
"AS2, well that throws a wrench in things lol. I can explain it to you, but I dont know all of the code for AS2 as I got into Flash at AS3.

I would assume that you would have 2 frames. 1 would hold your countdown which should be in its own movieclip with a number on each frame (coppied out for the length of 1 second). On the first frame of the countdown you will have a onrollover action that plays when rolled over. You will also have a onrollout function that will take you back to frame 1 if the user moves off of it. On the third image of the countdown you will need to have actions that gotoandplay the second frame on your main stage (holds the video).

That was kind of confusing, so if you have any questions, let me know."
----

I got that... but can you just help me a little with the scripts.
I have been back and forth with as3 and as2 today and I need help... I hit a wall.

So I just need a little help with the rollover/rollout actions for that countdown piece --- I do have all the frames set up. Just need their codes.

And then on the 3rd image of that countdown will need the gotoandplay action for the video.

Now... I am understanding that since that video will not have a rollover/rollout action, it will need some type of exit out button. Is that simple? I was thinking maybe add another button to exit out and that button would close both the video and toggle window.

This stuff is so confusing, so I hope I didnt just lose you.

Ive been at this for 12 hours now.. so I am a little zzzzzzzzzzz.

Thank you :D




cdolphin09
United States
Posts:19
Joined:Mar 28, 2011
 RE: Hover over Text to show video
 by RiverCityGraphix - Apr 18, 2011

So if Im understandign this rihgt, you need to know how the rollover/out code works and how to stop the video/close the window?

As for the rollovers:


stop();

Countdown_BTN.addEventListener(MouseEvent.ROLL_OVER, startrollover);

function startrollover(Event:MouseEvent){
play();
}

///Then you would have the rollout function

Countdown_BTN.addEventListener(MouseEvent.ROLL_OUT, stoprollover);

function stoprollover(Event:MouseEvent){
gotoAndStop(1);



In order to stop the video you would use somehing like this:

myvideo.stop();

Ive heard that sometimes the audio and video dont stop at the same time so you may need to use this to stop the audio: SoundMixer.stopAll();

You could assign those to a small X button that you make. When its clicked it will run those as well as an animaition to close the toggle window. That will work the same way as in my tutorial when you close the toggle window.


Be sure to subscribe on YouTube.

Do you take great photos? Consider selling them on Dreamstime.
RiverCityGraphix
United States
Posts:327
Joined:Nov 21, 2009
 RE: Hover over Text to show video
 by RiverCityGraphix - Apr 18, 2011

Sorry, I forgot a } at the end of that code after the gotoandstop(1);

Just didnt want that to throw you off.


Be sure to subscribe on YouTube.

Do you take great photos? Consider selling them on Dreamstime.
RiverCityGraphix
United States
Posts:327
Joined:Nov 21, 2009
 RE: Hover over Text to show video
 by cdolphin09 - Apr 18, 2011

ok, I got that far and it works.

One problem...

When the window toggles open the countdown works as it should... move the mouse off it goes away... but this action continues with the flv which plays after the countdown. How do I get that flv to stay there even if the mouse rollsover or out? I just want the user to hit the exit out in order to get out of that part.
Im not sure how I would add that in since its a video property. Im totally unfamiliar with that stuff.

But everything else works well :)
Thhhhaaaaannnnnkssss a million!


cdolphin09
United States
Posts:19
Joined:Mar 28, 2011
 RE: Hover over Text to show video
 by cdolphin09 - Apr 18, 2011

I have this for the exit button as well. Its stopping the video but its not closing the toggle window with on release... any ideas?

exit.addEventListener(MouseEvent.CLICK, stopmyvideo);
exit.addEventListener(MouseEvent.release, closewindow);

function stopmyvideo(Event:MouseEvent){

myvideo.stop();
SoundMixer.stopAll();

function closewindow(Event:MouseEvent){
window.gotoAndPlay (12);
}


}



cdolphin09
United States
Posts:19
Joined:Mar 28, 2011
 RE: Hover over Text to show video
 by RiverCityGraphix - Apr 18, 2011

It looks like you have two functions together. You should have a closing } after the soundmixer line. Also, I dont think yu would sue MouseEvent.release. I think just using CLICK would work fine there.

As for the question you had before. I would just remove the eventlistener once you are on the frame with the flv. It looks the same as addeventlistener except is says removeeventlistener. You may need to create an if statement for this depending on how your document is set up. It would be if the current frame is 20 then remove the events for rollover.


Be sure to subscribe on YouTube.

Do you take great photos? Consider selling them on Dreamstime.
RiverCityGraphix
United States
Posts:327
Joined:Nov 21, 2009
  
Home About Contact Forum Youtube Privacy Policy
Copyright © 2009-2011 RiverCityGraphix.All Rights Reserved.