Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

interactive presentation

New Here ,
Mar 26, 2009 Mar 26, 2009
Sorry for posting this again.. I'm a graphic designer and struggling to understand AS3. I've created a large presentation made up of 4 modules (as seperate swfs) each module is a click through, on the last button click I need to remove that swf and play the next swf. A point in the right direction would be greatly appreciated

Thanks

Darren
TOPICS
ActionScript
809
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 26, 2009 Mar 26, 2009
on Button put the following code

on(press)
{
loadMovie("swfpath");
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 26, 2009 Mar 26, 2009
ActionScript 3.0 you say? Because if that`s the case, what Darr_darshan suggested won`t work, because that`s AS2...

In AS3, you need to create your 'Next' button on the stage, give it an instance name, so that you can refer to it through ActionScript, and then type the following code:

// this creates a new Loader instance, which you use to load .swf, .jpg etc..
var lSwf:Loader = new Loader();
addChild(lSwf); // this is so that the Loader is actually displayed on the stage
var count:int = 0; // the current .swf index
var maxSwf:int = 10; // the number of .swfs you have...

// this is you 'Next' button to which you assign the 'onNextSwf' function when clicked
bNext.addEventListener(MouseEvent.CLICK, onNextSwf);

function onNextSwf(event:MouseEvent):void {
// the actual loading of the swf, provided you have the swfs named "yourSwf0.swf", "yourSwf1.swf", ... You will need to name them based on an index
lSwf.load(new URLRequest("yourSwf" + count + ".swf"));
count++; // so that next time you come click, you jump to the next swf
// if you reach the end of the swf "slideShow" you jump back to the beginning
if(count >= maxSwf) {
count = 0;
}
}


I haven`t really tested out this piece of code, I just typed it in here out of my head, so you`ll have to excuse the possible mistakes... I hope I have at least pointed you in the right direction 🙂
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 26, 2009 Mar 26, 2009
Thanks Ardy15jan,

I'll give that a go, does this script go in a 'masta' file or inside each swf?

Can I access label frames in the next swf and gotoandplay them? i.e on click go to and play "darren.swf/frame1" If I can would this be a better option?

Thank again.

Darren
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 27, 2009 Mar 27, 2009
Well...
The code I`v given you goes in the 'Master' swf, in which you only have your 'Next' button (and a background or something). In the same folder as your "master.swf" you have to place your other swfs and name them incrementally ("darren0.swf", "darren1.swf", ... ) so that you can use a counter to access them.

If you`re interested in the frame labels method, that`s a bit easier to do. See the code I`ve attached. Just follow my suggestions in preparing your animations MovieClip.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 28, 2009 Mar 28, 2009
Thanks again Ardy15jan,

The problem is that my seperate swfs have clicks all the way through. The 'main' swf doesnt have any buttons as this would over ride the buttons in my seperate swfs.

Darren
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 29, 2009 Mar 29, 2009
LATEST
If your animation swfs have ActionScript within (and buttons and stuff..), then it`s probably a better idea to load them in via a Loader (my first post), so the scripts run independently of the main one and you don`t get into complications.
But the 'Next' button should be placed in the 'Master.swf'.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines