Professional Web Applications Themes

help on sprite? - Macromedia Director Lingo

I'm stuck needing a slider bar that measures the amount played on a direct media sprite - I found something at Tabuleiro (xtras.tabuleiro.com) but can't seem to get the behavior to work properly - help, I need to deliver this this morning!! (have attched behaviour code) ........got stuck trying to assign the hiliteMember... The lingo I was trying to use was : -- DirectMediaXtra Time Slider -- based on the Video Time Slider from the behavior library version 1.1 -- requires an 'extent' cast member that limits the range the slider 'slides' -- controls the currenttime of a DirectMediaXtra sprite, ...

  1. #1

    Default help on sprite?

    I'm stuck needing a slider bar that measures the amount played on a direct media sprite - I found something at Tabuleiro (xtras.tabuleiro.com) but can't seem to get the behavior to work properly - help, I need to deliver this this morning!!

    (have attched behaviour code)


    ........got stuck trying to assign the hiliteMember...


    The lingo I was trying to use was :

    -- DirectMediaXtra Time Slider

    -- based on the Video Time Slider from the behavior library version 1.1
    -- requires an 'extent' cast member that limits the range the slider 'slides'
    -- controls the currenttime of a DirectMediaXtra sprite,
    -- if the sprite is playing the slider moves automatically


    property pDuration, pMovieTime, VideoSprite

    property extentSprite
    property hiliteMember -- looks like the handle plus hilite graphics
    -- also holds the member of handle while hilited

    property tracking
    property newLocH
    property newLocV

    property dynamic -- if true and sending true, sends value while tracking

    property min, max -- the range the slider maps to
    property valrange -- the difference of max and min, set on begin
    property minScreen, maxScreen -- calculated from the screen coords of the extent
    property currentScreenVal -- the data point in screen coords, set in tracking
    property extentlength -- in screen coords, set on begin

    property CurrentVal

    on getPropertyDescriptionList
    if the currentspritenum = 0 then
    set memdefault = 0
    else
    set memref = the member of sprite the currentspritenum
    set memdefault = member (the membernum of member memref 1)
    end if


    set description = [:]

    addprop description, #VideoSprite, [#default: 1, #format:#integer, #comment: "Video Sprite:"]

    addprop description, #extentSprite, [#default: 1, #format:#integer, #comment: "Extent Sprite:"]

    addprop description, #hiliteMember, [#default: memdefault , #format:#graphic,#comment: "Hilite Member:"]


    addprop description, #dynamic, [#default: 1, #format:#boolean,#comment: "Dynamic:"]

    return description
    end

    on getBehaviorDescription
    return "Drag to slider 'handle' to enable control of video play time. Requires additional 'extent' member which limits the handle travel range." & RETURN & "PARAMETERS:" & RETURN & "? Video Sprite - Enter the number of sprite channel in which video is displayed." & RETURN & "? Extent Sprite - Enter the number of sprite channel that contains the 'extent' sprite." & RETURN & "? Hilite Member - Member to display while handle is being dragged." & RETURN & "? Dynamic - If set, video time will be updated while handle is dragged, else when handle is released."
    end

    on compute_val me
    -- relies on tracking to update the currentScreenVal (different for Hor, Vert)
    set val = 0.0
    set val = float(the currentScreenVal of me) / float (the extentlength of me)
    set val = val * the valrange of me
    set val = val the min of me
    return val
    end

    on send_the_val me, val
    -- sets the digital video time to the val * paramter {0 - movieduration}
    set pMovieTime = val * pDuration
    videoseek(sprite VideoSprite, pMovieTime)

    end


    on beginSprite me

    set pDuration = the duration of sprite VideoSprite

    set the min of me = 0.0
    set the max of me = 1.0

    --
    set handle = the spritenum of me
    set the tracking of me = FALSE
    set the newLocH of me = the locH of sprite handle
    set the newLocV of me = the locV of sprite handle


    set the newLocV of me = the locV of sprite the extentSprite of me
    set the minScreen of me = the left of sprite the extentSprite of me
    set the maxScreen of me = the right of sprite the extentSprite of me


    set the locH of sprite handle to the newLocH of me
    set the locV of sprite handle to the newLocV of me

    set the valrange of me = the max of me - the min of me
    set the extentlength of me = the maxScreen of me - the minScreen of me

    end

    on prepareFrame me
    -- limits motion of handle to extents of extentSprite
    -- and locks the handle to the track of the extentSprite

    if tracking then
    set handle = the spriteNum of me
    set extent = the extentSprite of me


    set the newLocH of me = the mouseH
    set the newLocV of me = the locV of sprite extent
    if the newLocH of me < the left of sprite extent then
    set the newLocH of me = the left of sprite extent
    end if
    if the newLocH of me > the right of sprite extent then
    set the newLocH of me = the right of sprite extent
    end if

    set the currentScreenVal of me = the newLocH of me - the minScreen of me


    set the locH of sprite handle to the newLocH of me
    set the locV of sprite handle to the newLocV of me

    if the dynamic of me then
    send_the_val me, compute_val (me)
    end if

    else -- end if tracking, control slider position by movieTime

    if (float(pDuration)=0) then
    set pDuration = the duration of sprite VideoSprite
    end if

    if (float(pDuration)<>0) then
    set x = float(the currenttime of sprite VideoSprite)/ float(pDuration)
    end if

    set handle = the spriteNum of me
    set extent = the extentSprite of me

    set ScreenX = the left of sprite extent (x * (the right of sprite extent - the left of sprite extent))
    set the newLocH of me = screenX
    set the newLocV of me = the locV of sprite extent
    if the newLocH of me < the left of sprite extent then
    set the newLocH of me = the left of sprite extent
    end if
    if the newLocH of me > the right of sprite extent then
    set the newLocH of me = the right of sprite extent
    end if

    set the currentScreenVal of me = the newLocH of me - the minScreen of me

    set the locH of sprite handle to the newLocH of me
    set the locV of sprite handle to the newLocV of me

    end if

    end

    on mouseDown me
    set tracking = TRUE
    set temp = the member of sprite the spritenum of me
    set the member of sprite the spritenum of me = member the hiliteMember of me
    set the hiliteMember of me = temp
    end

    on mouseUp me
    set tracking = FALSE
    set temp = the member of sprite the spritenum of me
    set the member of sprite the spritenum of me = member the hiliteMember of me
    set the hiliteMember of me = temp

    end

    on mouseUpOutside me
    set tracking = FALSE
    set temp = the member of sprite the spritenum of me
    set the member of sprite the spritenum of me = member the hiliteMember of me
    set the hiliteMember of me = temp



    --AUTHOR: LAST UPDATED:


    --Mauricio Piacentini, Tabuleiro Feb 2, 2001




    --Copyright Info © 2003 Tabuleiro Produções Ltda. All rights reserved Company Policies





    jaf webforumsuser@macromedia.com Guest

  2. #2

    Default Re: help on sprite?

    i used this behavior some time ago. the extent sprites can be a tool
    rect, i think that defines how far things move.

    posting complete copyrighted scripts might not be a good practive
    JB Guest

Similar Threads

  1. sprite on top the w3d
    By Elriowiel in forum Macromedia Director 3D
    Replies: 1
    Last Post: June 5th, 10:51 AM
  2. Overlay of 2d sprite over a 3d sprite
    By lithiumcell in forum Macromedia Director 3D
    Replies: 2
    Last Post: May 25th, 12:04 PM
  3. sprite(n).loc - help!
    By djmasala.com in forum Macromedia Director Basics
    Replies: 1
    Last Post: November 21st, 09:20 AM
  4. Sprite detecting sprite
    By AJJA17 webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 4
    Last Post: November 11th, 05:20 PM
  5. Search text in sprite and play the sprite
    By Godwin in forum Macromedia Director Lingo
    Replies: 2
    Last Post: July 23rd, 01:06 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139