A Flash Developer Resource Site

Results 1 to 18 of 18

Thread: YouTube style play button?

  1. #1
    Junior Member
    Join Date
    Jan 2009
    Posts
    11

    YouTube style play button?

    Hi, I just upgraded to KM v7 and hoped to find an option to add a YouTube style translucent play button on my video. I'm new to action scripting and have been searching these forums with no luck. Any help would be great! Thanks

  2. #2
    Member
    Join Date
    Jul 2005
    Location
    Indiana, USA
    Posts
    79
    Actually there is an arrow button similar to the YouTube button in the navigation folder. Button colors can be changed - both in the up and over position. You can swap out the oval background with a rounded rectangle background. And you can also control opacity of the button using the opacity slider control in the color selection module.

    You can place the button over an image of the video in its video frame that will load your video to play. All this can be done without action script.
    The KoolMoves KoolExchange is one KoolPuppy.

    E-Z Websites

  3. #3
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    You probably do need to use ActionScripting for this. However the best bet would be to make a new skin.

    Soon as I can find the Skin API again, I'll look at doing one.

  4. #4
    Junior Member
    Join Date
    Jan 2009
    Posts
    11
    Yeah, a video media player skin with a super imposed play button that disappears after clicking on it would be excellent. I'm trying to add one to the TinyVid skin but I'm in unfamiliar territory. I did find a tutorial on the net with an action script snippet but it didn't work with Koolmoves. A step-by-step tutorial or a ready made skin for doing this in Koolmoves would be very Kool!

  5. #5
    Member
    Join Date
    Jul 2005
    Location
    Indiana, USA
    Posts
    79
    The KoolMoves KoolExchange is one KoolPuppy.

    E-Z Websites

  6. #6

  7. #7
    Junior Member
    Join Date
    Jan 2009
    Posts
    11
    Thanks for the source file Phil. That was helpful. I got my video to play using the button but the movie will not return to the start button frame after it's finished. I guess I need a way to detect the end of the .flv and direct it back to the first frame. I'm doing some research but so far I haven't found anything.

  8. #8
    Member
    Join Date
    Jul 2005
    Location
    Indiana, USA
    Posts
    79
    All depends on how you intend to set up your movies. Without Actionscript abilities I am always looking for workarounds and depend heavily on the people here.

    My simple workaround for the issue you mention is to place a transparent button over the entire movie. Just click on the movie and it takes you back home.

    http://www.michianaworldwide.com/KM/...he-jungle.html
    The KoolMoves KoolExchange is one KoolPuppy.

    E-Z Websites

  9. #9
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    Just in case someone is interesed in how an additional self made play button named myButton placed on top of a media player named mediaplayer1 can be connected with the media player
    Code:
    myButton.addEventListener('click', myButtonClick);
    
    mediaplayer1.addEventListener('playlistSet', mpPlaylistSet);
    mediaplayer1.addEventListener('itemComplete', mpItemComplete);
    mediaplayer1.btnPlay.addEventListener('click', mpBtnPlayClick);
    mediaplayer1.btnStop.addEventListener('click', mpBtnStopClick);
    
    function myButtonClick(e:Event):void {
    	mediaplayer1.play();
    	myButton.visible = false;
    }
    
    function mpPlaylistSet(e:Event):void {
    	mediaplayer1.playlistOptions.pause = 'before';
    	mediaplayer1.pause();
    }
    
    function mpItemComplete(e:Event):void {
    	myButton.visible = true;
    }
    
    function mpBtnPlayClick(e:Event):void {
    	myButton.visible = false;
    }
    
    function mpBtnStopClick(e:Event):void {
    	myButton.visible = true;
    }
    
    mpPlaylistSet(null);

  10. #10
    Junior Member
    Join Date
    Jan 2009
    Posts
    11
    I placed a button named myButton on top of my mediaplayer1 and added the above code to the button Action Script Editor and I get the ERROR MESSAGE...

    Line 1: myButton.addEventListener(', myButtonClick);
    expecting a mouse event statement

  11. #11
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    Since you mentioned you upgraded to KM7, I was under the impression you wanted to use ActionScript 3. In the ActionScript Editor window you can set what version you want to use. The code I gave is ActionScript 3 code and requires the editor to be set on AS3 (this also means the export will target Flash Player 9).

    Edit:
    I see your line also misses a part ( 'click' ).

  12. #12
    Junior Member
    Join Date
    Jan 2009
    Posts
    11
    Ah! now we're getting somewhere. I needed to set KoolMoves export settings to AS3 and now it kinda works...I get sound but no video unless I hit pause and then nudge the time slider a bit. Even without the button I get the same result. Is this some kind of bug?

  13. #13
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    There's not a bug I am aware of but of course it's possible.
    In this case however you are giving not enough information to help out. A few things that are important for example are the codec used to encode the video file and if you are trying things out locally or from the net.

  14. #14
    Member
    Join Date
    Jul 2005
    Location
    Indiana, USA
    Posts
    79
    The code works all right.
    The KoolMoves KoolExchange is one KoolPuppy.

    E-Z Websites

  15. #15
    Junior Member
    Join Date
    Jan 2009
    Posts
    11
    So far I've only tested locally. I'll try some different things and see what happens. Thank you all very much for your help!

  16. #16
    Member
    Join Date
    Dec 2005
    Location
    Utah
    Posts
    98
    Chris, is this a single- or multiple-frame swf? I'm having a tough time getting the first frame of the referenced playlist item to load. Sure it's an operator error problem on my end.

    Thanks for the info!

    Mary

    Quote Originally Posted by Chris_Seahorn View Post
    With Actionscript

    http://krazyaboutpizza.co.uk/KM7/YouTubeLikeFLV.html

    I just wanted a reason to play with TweenMax (thanks Bob!)

  17. #17
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    Surprised the krazyaboutpizza domain is still chugging. Hate having those old references floating around

    I posted the source in our Codex Source Code section (KM7/AS3). Mine requires the Tweenmax classes be installed btw.

    http://www.km-codex.com/?page_id=85

  18. #18
    Member
    Join Date
    Dec 2005
    Location
    Utah
    Posts
    98
    Thanks for the help, Chris! And, especially, thanks for helping those poor mugs like me who feel like babes amongst the elders here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center