Jump to content
GreenSock

Search the Community

Showing results for tags 'loader swf image'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GreenSock Forums
    • GSAP
    • Banner Animation
    • Jobs & Freelance
  • Flash / ActionScript Archive
    • GSAP (Flash)
    • Loading (Flash)
    • TransformManager (Flash)

Product Groups

  • Club GreenSock
  • TransformManager

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. Hi, i´ve been trying to search a free open source application for android magazine, and i couldn´t find nothing, so this project will be to build a open source code for magazine to use in google play for android apk with adobe air. the project is at github https://github.com/souzadavi/dsmagazine I want to use LoaderMax for this project. I would like to load at same time only 3 pages, so will be the current page, last page and next page. When an user swipe the page to left or right the magazine pre load the page, this should work by this way because this magazine will run on tablet, so we don´t have too much memory avalaible. Any other ideia will be appreciate also. I`m using this http://www.greensock.com/as/zip/PanelScrollExample.zip but i´m loading all pages and added in stage, this is taking a lot of memory. I would like to load 3 by 3.... Any help will be very appreciate. MY XML IS: <?xml version="1.0" encoding="utf-8"?> <data> <configs load="false"> <screen height="1232" width="800" aspectioRatio="portrait" /> <book name="Demo" /> <chapters quantity="1" /> </configs> <book> <chapter name="Demo Parte 1" load="true"> <page file="1/page_1.jpg" type="image" /> <page file="1/page_2.jpg" type="image" /> <page file="1/page_3.jpg" type="image" /> <page file="1/page_4.jpg" type="image" /> </chapter> <chapter name="Demo Parte 2" load="false"> <page file="1/page_1.jpg" type="image" /> <page file="1/page_2.jpg" type="image" /> <page file="1/page_3.jpg" type="image" /> <page file="1/page_4.jpg" type="image" /> </chapter> </book> </data> AS3 CODE: package com.core{ import com.greensock.events.LoaderEvent; import com.greensock.loading.*; import flash.display.Sprite; import flash.events.MouseEvent; import flash.net.URLLoader; import flash.net.URLRequest; import flash.utils.getTimer; import flash.events.Event; import flash.geom.Rectangle; import com.greensock.TweenLite; import com.greensock.easing.Strong; public class Magazine extends Sprite { private var _pageBounds:Rectangle; private var _container:Sprite; private var _currentPageIndex:int = 0; private var _pageCount:int; private var _x1:Number; private var _x2:Number; private var _t1:uint; private var _t2:uint; public function Magazine(){ this.init(); } private function init():void { var xmlLoader:XMLLoader = new XMLLoader("configs/book.xml", {onComplete:_xmlCompleteHandler}); xmlLoader.load(); } private function _xmlCompleteHandler(event:LoaderEvent):void { var configs:XMLList = event.target.content.configs; var chapters:XMLList = event.target.content.book.chapter; _pageBounds = new Rectangle(0, 0, Number(configs.screen.@width), Number(configs.screen.@height)); _container = new Sprite(); _container.x = _pageBounds.x; _container.y = _pageBounds.y; addChildAt(_container, 0); _container.addEventListener(MouseEvent.MOUSE_DOWN, _mouseDownHandler, false, 0, true); _pageCount = chapters.page.length(); var queue:LoaderMax = new LoaderMax(); for (var i:int = 0; i < _pageCount; i++) { //trace("PAGINAS CONTADAS:"+ chapters.page[i].@type); switch (String(chapters.page[i].@type)){ case "image" : queue.append( new ImageLoader("assets/" + chapters.page[i].@file, {x:i * _pageBounds.width, width:_pageBounds.width, height:_pageBounds.height, container:_container}) ); break; case "swf" : queue.append( new SWFLoader("assets/" + chapters.page[i].@file, {x:i * _pageBounds.width, width:_pageBounds.width, height:_pageBounds.height, container:_container}) ); break; } } //feel free to add a PROGRESS event listener to the LoaderMax instance to show a loading progress bar. queue.load(); } private function _mouseDownHandler(event:MouseEvent):void { TweenLite.killTweensOf(_container); _x1 = _x2 = this.mouseX; _t1 = _t2 = getTimer(); _container.startDrag(false, new Rectangle(_pageBounds.x - 9999, _pageBounds.y, 9999999, 0)); this.stage.addEventListener(MouseEvent.MOUSE_UP, _mouseUpHandler, false, 0, true); this.addEventListener(Event.ENTER_FRAME, _enterFrameHandler, false, 0, true); } private function _enterFrameHandler(event:Event):void { _x2 = _x1; _t2 = _t1; _x1 = this.mouseX; _t1 = getTimer(); } private function _mouseUpHandler(event:MouseEvent):void { _container.stopDrag(); this.removeEventListener(Event.ENTER_FRAME, _enterFrameHandler); this.stage.removeEventListener(MouseEvent.MOUSE_UP, _mouseUpHandler); var elapsedTime:Number = (getTimer() - _t2) / 1000; var xVelocity:Number = (this.mouseX - _x2) / elapsedTime; //we make sure that the velocity is at least 20 pixels per second in either direction in order to advance. Otherwise, look at the position of the _container and if it's more than halfway into the next/previous panel, tween there. if (_currentPageIndex > 0 && (xVelocity > 20 || _container.x > (_currentPageIndex - 0.5) * -_pageBounds.width + _pageBounds.x)) { _currentPageIndex--; } else if (_currentPageIndex < _pageCount - 1 && (xVelocity < -20 || _container.x < (_currentPageIndex + 0.5) * -_pageBounds.width + _pageBounds.x)) { _currentPageIndex++; } TweenLite.to(_container, 0.7, {x:_currentPageIndex * -_pageBounds.width + _pageBounds.x, ease:Strong.easeOut}); } } } thanks DS
×