as3.0制作电子书

发布网友 发布时间:2024-10-23 22:54

我来回答

2个回答

热心网友 时间:3分钟前

网上找一下这个开源类:PageFlipClass.as
用法:
package src.com
{
import flash.net.URLLoader;
import flash.display.Loader;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import com.page.PageFlipClass;

public class Cover extends MovieClip
{

private var urlReq:URLRequest;
private var loader:Loader;

private var urlRq:URLRequest;
private var urlLoader:URLLoader;
private var xml:XML;
public var pageFlip:PageFlipClass;
private var mc:MovieClip;

public function Cover()
{
// constructor code
mc = new MovieClip();
loadXml("picAndXMl/data.xml");
pageFlip = new PageFlipClass();
}

public function loadXml(url:String):void
{
urlRq = new URLRequest(url);
urlLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, xmlLoadComplete);
urlLoader.load(urlRq);
}

private function xmlLoadComplete(e:Event):void
{
this.addChild(mc);
xml = XML(e.target.data);
this.pageFlip.myXML = xml;
this.pageFlip.book_root = mc;
this.pageFlip.book_initpage = 0;
this.pageFlip.book_TimerNum = 30;
this.pageFlip.InitBook();
mc.x = -this.pageFlip.width;
}
}

}
保存图片路径的XML的写法
<?xml version="1.0" encoding="utf-8"?>
<data width="600" height="800">
<pic>图片路径,有多少张写多少个,偶数个</pic>
<pic>图片路径,有多少张写多少个,偶数个</pic>
<pic>图片路径,有多少张写多少个,偶数个</pic>
<pic>图片路径,有多少张写多少个,偶数个</pic>
</data>

热心网友 时间:2分钟前

bbs.9ria.com/thread-179119-1-3.html
声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。
E-MAIL:11247931@qq.com