Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

button does not work in conjunction with animate? #75

Open
nanenj opened this issue Feb 25, 2013 · 2 comments
Open

button does not work in conjunction with animate? #75

nanenj opened this issue Feb 25, 2013 · 2 comments

Comments

@nanenj
Copy link

nanenj commented Feb 25, 2013

Fiddling around with an MP3 player. The following code the link and the image 'button' works where as the -actual- button does not. Also the value for a video object's length does not appear to be calculated until the video is being played. (Or at least that's the case when playing .ogg files).

Removing the animate block entirely, the button actually works

require 'green_shoes'

Shoes.app( :width => 320, :height => 240, :title => "Ogg Player Demo" ) do
  space = " " * 3
  @song = video "c:/Repos/Ruby/mp3Player/song2.ogg"

  @link_Play = para space, link("Play") { @song.play },
        space, link("Pause") { @song.pause },
        space, link("Stop") { 
          @song.stop
          @song = video ''
        }

  @lbl_songLength = para('')

  @btn_Play = button "Play"
  @btn_Play.click { 
    @song.play
    @songLength = @song.length.to_i/1000
  }

  @img_Play = image "c:/Repos/Ruby/mp3Player/play_18x24.png"
  @img_Play.click { @song.play }
  animate do
    @songLength = @song.length.to_i/1000
    if @songLength != 0
      @lbl_songLength.replace("#{@songLength}")
    else
      @lbl_songLength.replace('')
    end
  end
end
@ashbb
Copy link
Owner

ashbb commented Feb 25, 2013

@nanenj Thanks for the post. Yes, this is a problem. But sorry, I have no solution for now. A workaround is to slow the rate of animate, e.g. animate(1). Not a good workaround though... xx-P

@nnadboralski-zz
Copy link

Okay, thanks for the confirmation at least, I still thought I was going crazy even after testing many, many different scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants