Author Topic: Load external animated movie swf file into megazine (the newbie way)?  (Read 2055 times)

hanzc

  • Newbie
  • *
  • Posts: 10
Hi,

I am trying to load my swf file into the book the normal way:

        <page stiff="true">
            <img height="550" width="390" src="photos/page1.swf" hires="photos/original/page1.jpg"/>
        </page>

The swf is loaded only at the first frame. I am not able to animate the swf file's content.

I think somewhere in the forum, it mentioned that I need to add the following codes:

--------------------------------------------------------------------------------------------------------------------

import de.mightypirates.megazine.IMegaZine;
import de.mightypirates.megazine.IPage;
import de.mightypirates.megazine.elements.AbstractElement;
import de.mightypirates.megazine.gui.ILibrary;
import de.mightypirates.megazine.events.MegaZineEvent;
var mz:IMegaZine;
function megazineSetup(mz:IMegaZine, page:IPage, even:Boolean):void {
    page.addEventListener(even ? MegaZineEvent.VISIBLE_EVEN : MegaZineEvent.VISIBLE_ODD, onPageVisible);
}
 
function onPageVisible(e:MegaZineEvent):void {
    // Page is now visible
}

----------------------------------------------------------------------------------------------------------------

The problem is, I am not a very good Flash programmer (quite new actually).
I also do not know how I can download the source and how I actually need to find the right file to modify and then eventually compile it to make it work for my swf. (quite fustrated)

Is there any simpler ways to do it? I can't make it work.

Thanks In Advance.
Mike

hanzc

  • Newbie
  • *
  • Posts: 10
Re: Load external animated movie swf file into megazine (the newbie way)?
« Reply #1 on: November 12, 2009, 05:06:39 pm »
I've changed the code into:

var pageNumber:int;
function megazineSetup(mz:*, ps:*):void {
    pageNumber = ps.number + (ps.number & 1);
    mz.addEventListener("page_change", handlePageChange, false, 0, true);
}
 
function handlePageChange(e:*):void {
    if (e.newPage == pageNumber) {
        // Now main page
        play();
    } else if (e.oldPage == pageNumber) {
        // No longer main page
        stop();
    }
}


The above are all being put into the actionscript inside the first frame on a separate layer.
It still does not work.

FYI, my swf file need to be loaded on the first page of the book, which means, the animation start on the first page.

Thanks.
Mike

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1985
  • MegaZine3 Developer
    • MegaZine3
Re: Load external animated movie swf file into megazine (the newbie way)?
« Reply #2 on: November 12, 2009, 06:50:41 pm »
Mm. Try adding a
Code: (actionscript3)
  1. if (pageNumber == mz.currentLogicalPage) {
  2.    play();
  3. }

to the megazineSetup function (after adding the listener), that way checking if it might already be visible.
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.

hanzc

  • Newbie
  • *
  • Posts: 10
Re: Load external animated movie swf file into megazine (the newbie way)?
« Reply #3 on: November 17, 2009, 09:45:05 am »
thanks