#
# Movie control example with Swftools http://www.quiss.org/swftools/
#
# Play, Stop, Nextframe and jump to frame number with edittext entry
#
#
.flash bbox=250x200 version=6 name="moviecontrol.swf" compress
.font myfont "../font/Automaton.swf"
.box fond width=250 height=200 color=gray fill=white line=2
.box button_idle width=60 height=25 color=blue fill=salmon line=3
.box button_hover width=60 height=25 color=red fill=salmon line=3
.box button_pressed width=60 height=25 color=gray fill=salmon line=3
.circle ball r=15 color=blue fill=red line=2
.circle axe1 r=2 color=red fill=red line=2
.circle axe2 r=2 color=red fill=red line=2
.text text1 font=myfont text="Play" color=blue size=50%
.text text2 font=myfont text="Stop" color=blue size=50%
.text text3 font=myfont text="Next" color=blue size=50%
.text text4 font=myfont text="Goto" color=blue size=50%
.text text5 font=myfont text="Prev" color=blue size=50%
.edittext info text="####" color=blue font=myfont size=50% width=60 height=25 multiline wordwrap border variable=textvar
.sprite m_ball
.put ball
.end
.sprite movie_sprite
.frame 0
.put m_ball pin=center 40 20
.frame 50
.change m_ball pin=center 125 100
.frame 100
.change m_ball pin=center 210 20
.frame 150
.change m_ball pin=center 125 100
.frame 200
.change m_ball pin=center 40 20
.end
.button button1
.show button_idle as=idle
.show button_idle as=shape
.show button_idle as=area
.show button_hover as=hover
.show button_pressed as=pressed
.on_press:
MovieCtrl1();
.end
.end
.button button2
.show button_idle as=shape
.show button_idle as=area
.show button_hover as=hover
.show button_pressed as=pressed
.on_press:
MovieCtrl2();
.end
.end
.button button3
.show button_idle as=shape
.show button_idle as=area
.show button_hover as=hover
.show button_pressed as=pressed
.on_press:
MovieCtrl3();
.end
.end
.button button4
.show button_idle as=shape
.show button_idle as=area
.show button_hover as=hover
.show button_pressed as=pressed
.on_press:
MovieCtrl4();
.end
.end
.button button5
.show button_idle as=shape
.show button_idle as=area
.show button_hover as=hover
.show button_pressed as=pressed
.on_press:
MovieCtrl5();
.end
.end
#
# Place Objects
#
.put fond
.put button1 x=20 y=160
.put text1 pin=center 50 172
.put button2 x=95 y=160
.put text2 pin=center 125 172
.put button3 x=170 y=160
.put text3 pin=center 200 172
.put button5 x=170 y=127
.put text5 pin=center 200 140
.put button4 x=20 y=127
.put text4 pin=center 50 140
.put info pin=center 125 140
.put axe1 pin=center 5 5
.put axe2 pin=center 245 5
#
# ActionScript
#
.action:
_root.createEmptyMovieClip("movie",400);
_root.attachMovie("movie_sprite","movie",400);
movie.stop();
var monStyle = new TextFormat();
monStyle.align = "center";
monstyle.size = 45;
info.setnewTextFormat(monStyle);
function MovieCtrl1() {
movie.play();
idinterval = setInterval(UpdateCounter, 30);
}
function MovieCtrl2() {
clearInterval(idinterval);
movie.stop();
}
function MovieCtrl3() {
movie.nextframe();
UpdateCounter();
}
function MovieCtrl4() {
clearinterval(idinterval);
movie.gotoAndstop(textvar);
UpdateCounter();
}
function MovieCtrl5() {
movie.prevframe();
UpdateCounter();
}
function UpdateCounter() {
textvar = movie._currentframe;
DrawLines();
}
function DrawLines() {
_root.createEmptyMovieClip("movie_line",300);
with (_root.movie_line) {
beginFill (0x0000FF, 50);
lineStyle (1, 0x0000FF, 100);
moveTo(5,5);
lineTo ( movie.m_ball._x + 15 , movie.m_ball._y + 15);
endFill();
beginFill (0x0000FF, 50);
lineStyle (1, 0x0000FF, 100);
moveTo(245,5);
lineTo ( movie.m_ball._x + 15 , movie.m_ball._y + 15);
endFill();
}
}
UpdateCounter();
.end
.end # End swf movie