A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Seek button for FLV component

  1. #1
    Member
    Join Date
    Nov 2007
    Posts
    41

    Seek button for FLV component

    Hey all - I'm building an flv player using the cs4/as3 video playback component as a basis with custom buttons on the interface. I'm trying to figure out how to do rewind or fastfoward using a button instead of a scrub bar. I've seen plenty of tutorials on how to develop a scrub bar but I can't figure out a way to apply the theory to a button you hold down and it fast forwards/rewinds until you mouse off.

    Obviously a mouse_down event only fires one signal and causes a jump effect if you click repeatedly, so is there a way of firing multiple events whilst holding down the mouse button?

    I'm using
    Code:
    flvPlaybackComponentname.seek(flvPlaybackComponentname.playheadTime + fastForwardSeekAmount);
    to achieve the skip through the video, but this only happens as I said with multiple clicks.

    Any suggestions??

    thanks

    frank

  2. #2
    Senior Member
    Join Date
    May 2004
    Posts
    226
    If you use the BaseButton class (or a Button component) it has an autoRepeat property that will do what you want:
    http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/index.html?fl/controls/BaseButton.html&fl/controls/class-list.html

  3. #3
    Member
    Join Date
    Nov 2007
    Posts
    41
    Hi thanks for that - but the code on that page a) doesn't work and b) flash cs4 doesn't know or seem to know what a ComponentEvent is - even with the events package imported into flash, it still produces a 1046 error.

    I even tried the code at Adobe itself -

    Code:
    import fl.controls.Button;
    import fl.controls.Label;
    import fl.events.ComponentEvent;
    
    var myLabel:Label = new Label();
    myLabel.text = "0";
    myLabel.move(10, 10);
    addChild(myLabel);
    
    var downButton:Button = new Button();
    downButton.label = "-";
    downButton.autoRepeat = true;
    downButton.setSize(20, 20);
    downButton.move(10, 30);
    downButton.addEventListener(ComponentEvent.BUTTON_DOWN, buttonDownHandler);
    addChild(downButton)
    
    var upButton:Button = new Button();
    upButton.label = "+";
    upButton.autoRepeat = true;
    upButton.setSize(20, 20);
    upButton.move(40, 30);
    upButton.addEventListener(ComponentEvent.BUTTON_DOWN, buttonDownHandler);
    addChild(upButton);
    
    function buttonDownHandler(event:ComponentEvent):void {
        var value:Number = Number(myLabel.text);
        switch (event.currentTarget) {
            case downButton:
                value--;
                break;
            case upButton:
                value++;
                break;
        }
        myLabel.text = value.toString();
    }
    and it still errors! What hope is there for learner developers if the samples don't work?

    frank

  4. #4
    Senior Member
    Join Date
    May 2004
    Posts
    226
    Almost there, just drag a Button from the Components window into your Library window. A component cannot be created purely in AS3, they depend on the component (and its associated assets) being in your library.

  5. #5
    Member
    Join Date
    Jul 2001
    Location
    Nairobi, Kenya
    Posts
    98
    Not sure if I can post this here, perhaps you can direct me elsewhere.

    I have an e-learning application developed lets say a story book with audio and flash displaying the text, page by page. The audio is an FLV with cue points.

    Can I skip to the end of this book or chapter using query strings? The application runs with .net and has post backs.

    What I require is instead of sitting there listening/ reading to 20 mins of audio I'd like to skip to almost the end of the file where a questionaire resides about the chapter. While testing in flash I use the ns.seek(440); etc but need this to be dynamic where I can control the value if the seek using query strings or an external button (outside the flash). It should be an easy solution but dont know how to implement. Thanks.

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