| View previous topic :: View next topic |
| Author |
Message |
Christopher Guest
|
Posted: Wed Jan 28, 2004 11:09 am Post subject: swf control |
|
|
I would like to control the swf that is exported from Impress. I currently have a flash movie that it is loaded into and I would like to control the prentations behaviour. I.e Forward, Backward, eliminate the press function. etc. is this possible, is there any documentation on this?
Cheers,
Christopher
chris.callender@ec.gc.ca |
|
| Back to top |
|
 |
anvilsoup Super User


Joined: 09 Feb 2003 Posts: 606 Location: Australia, mate!
|
Posted: Wed Jan 28, 2004 5:35 pm Post subject: |
|
|
| no. but swf export is still pretty neat! |
|
| Back to top |
|
 |
Christopher Guest
|
Posted: Thu Jan 29, 2004 12:21 pm Post subject: |
|
|
of course its pretty neat! with out the control I can't use it.. This actually works:
| Code: |
stop();
slide.loadMovie("test.swf",get);
slideshow = setInterval(nextSlides,1000);
function nextSlides() {
slide.gotoAndStop(slide._currentframe + 1);
} |
But of course I need a little more control then that.
I have tried using "Actionscript Reader" but the produced swf keeps crashing it.
Any help or guide is much appreciated.
Cheers,
Christopher |
|
| Back to top |
|
 |
Dove Guest
|
Posted: Thu Mar 25, 2004 9:06 pm Post subject: swf control |
|
|
After some experimenting and use of SWF decompiler to view the (minimal) actionscripts in the generated swf, I've been able to generate a simple fla file that loads the swf into a newly created clip and has a separate controller clip that allows forward and back control and current slide number display. The code also switches off the standard 'click to move forward' button inside the swf that Impress generates.
A few things:
1. You need to advance and rewind 2 frames each time to go forward/backward one slide.
2. I found something weird when trying to go back frames. Not sure why but I could only get it to work reliably by sending the playhead to the first frame and/or the last frame before using gotoAndStop for the target frame inside the loaded clip.
in your code example this would be something like:
destination = slide._currentframe-1;// or -2 to get to the previous slide
slide.gotoAndStop(1);
slide.gotoAndStop(slide._totalframes);
slide.gotoAndStop(destination);
3. I found that the flash stage size was best set to 720 x 540 for most presentations
4. In your code example, try
slide.instance9.enabled = false;
Try putting this inside the nextSlides function to ensure it is activated after the clip has fully loaded. In the exported presentations that I tested, this disabled the button.
I hope this works; let me know. |
|
| Back to top |
|
 |
zodar Newbie

Joined: 18 Feb 2005 Posts: 2 Location: Italy
|
Posted: Fri Feb 18, 2005 1:05 am Post subject: |
|
|
I fixed the navigation problem (with flash) in this way:
create two button, one for "next frame", one for "previous frame".
ActionScript code for "Next Frame":
| Code: |
slide.play();
cond=1;
|
AS code for "Prev Frame":
| Code: |
point = slide._currentframe;
slide.gotoAndStop(point-3);
if (cond=1) {
slide.play();
cond=0;
}
slide.play();
|
I hope that it could be useful...
Regards
Zodar _________________ fOrMaT mAn |
|
| Back to top |
|
 |
coco Newbie

Joined: 23 Mar 2005 Posts: 1
|
Posted: Wed Mar 23, 2005 4:40 pm Post subject: |
|
|
For the non-developers among us what are the steps needed to get navigation controls in the swf file?
Thanks |
|
| Back to top |
|
 |
zodar Newbie

Joined: 18 Feb 2005 Posts: 2 Location: Italy
|
Posted: Thu Mar 24, 2005 12:42 am Post subject: |
|
|
Without actionscript, navigation control is impossible. Anyway, its use is quite simple.
For "Previous Frame" button:
1- Create a shape
2- Right click on it, "Convert to symbol"
3- Choose "button"
4- In the property inspector give to this button a name (instance name), i.e. "goPrev"
5- Select the frame in the timeline panel
6- Select Action panel and write:
| Code: |
goPrev.onRelease = function() {
// "point" and "cond" are simply variables
// "slide" is the istance name of the swf movie loaded
// (the swf created with OOo)
point = slide._currentframe;
slide.gotoAndStop(point-3);
if (cond=1) {
slide.play();
cond=0;
}
slide.play();
}
|
For Next Frame button:
Create another button, like above, but with the istance name, i.e., "goNext".
And the code is only:
| Code: |
goNext.onRelease = function() {
slide.play();
cond = 1;
}
|
Although it could seem (or better... IT IS) incomprehensible, right use of "cond" variable is very important.
At least, it works
Zodar _________________ fOrMaT mAn |
|
| Back to top |
|
 |
anuragd Newbie

Joined: 28 Dec 2009 Posts: 1
|
Posted: Mon Dec 28, 2009 9:27 am Post subject: |
|
|
Although the above code does work. It has one bug: You can never make it back to the first slide. If you click goPrev it will keep cycling between slide 2 and 3. After a lot of hit & try runs, I figure, the following code works:
| Code: | goPrev.onRelease = function() {
point = slide._currentframe;
switch(point)
{
case 1:
return;
break;
case 3:
mcLoader.loadClip("./Presentations/adventure.swf", slide);
break;
default:
slide.gotoAndStop(point-3);
}
if (cond==1) {
slide.play();
cond=0;
}
slide.play();
}
goNext.onRelease = function() {
slide.play();
cond = 1;
} |
_________________ http://anuragd.com |
|
| Back to top |
|
 |
|