Jump to content
GreenSock

penny

Members
  • Posts

    9
  • Joined

  • Last visited

penny's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. No errors, I would post them if I got any. While testing title bar on Windows gets "(Not responding)" and nothing happens. The code I posted works for you?
  2. Hi, I'm creating a website header, with images and SWFs loaded into it. The code below: package { import com.greensock.events.LoaderEvent; import com.greensock.loading.ImageLoader; import com.greensock.loading.LoaderMax; import com.greensock.loading.SWFLoader; import com.greensock.loading.XMLLoader; import com.greensock.loading.core.DisplayObjectLoader; import flash.display.Sprite; import flash.display.StageScaleMode; [sWF(width="960", height="435", frameRate="30", backgroundColor="#FFFFFF")] public class Header extends Sprite { private var types:Object = {png: ImageLoader, jpg: ImageLoader, swf: SWFLoader}; private var queue:LoaderMax = new LoaderMax({onComplete: onQueueComplete}); private var items:XMLList; public function Header() { stage.scaleMode = StageScaleMode.NO_SCALE; stage.showDefaultContextMenu = false; LoaderMax.activate([imageLoader, SWFLoader]); var loader:XMLLoader; var params:Object = {onOpen: onOpen, onProgress: onProgress, onComplete: onComplete, noCache: true, autoDispose: true}; CONFIG::DEBUG { loader = new XMLLoader("data.xml", params); } CONFIG::RELEASE { loader = new XMLLoader(this.root.loaderInfo.parameters.dataURL, params); } loader.load(); } private function onOpen(e:LoaderEvent):void { trace("onOpen"); } private function onProgress(e:LoaderEvent):void { trace("onProgress"); } private function onComplete(e:LoaderEvent):void { var data:XML = e.target.content; items = data.item; var i:int = items.length(), item:XML; var url:String, type:String; var params:Object = {onComplete: onItemComplete, autoDispose: true}; var loader:DisplayObjectLoader; while (--i > -1) { item = items[i]; url = item.content[0].toString(); type = url.toLowerCase().split("?")[0]; type = type.substr(type.lastIndexOf(".") + 1); loader = new types[type](url, params); queue.append(loader); } queue.load(); } private function onItemComplete(e:LoaderEvent):void {} private function onQueueComplete(e:LoaderEvent):void {} } } Setting autoDispose to true for each loader makes the SWF freeze. Any tips, why is that happening and what to do with it?
  3. I've noticed it, when i started using LoaderMax, but in fact there is some server side stuff with images loading. I'll take a look at that. Thanks for pointing this out.
  4. Hm, sorry but I can't. This happens on a project that I work on right now, but it doesn't happen every time - from my point of view it's irreproductable (ugh, I don't know if such a word exists ) in other conditions. Basicly it happens when a site is loaded (it consists of 3 modules), and when you click on a button that navigates to other URL error is thrown. It doesn't affect the end user (if he doesn't have Flash Player Debug), because immediately after error reload occurs. I decided to put it on forums with hope that anyone else had experienced something similar. Well, for now I will have to live with it. If i get any idea of where the problem comes form I'll post a reply.
  5. Hi, has anyone experienced it? What to do to fix it?
  6. I've looked into docs, and using rawContent seems fine - or maby creating custom module loader is easy and has some benefits. What do you think?
  7. Hi, what is the flow of writing own loaders? For example i would like to have a module loader - all my modules implement IModule interface, and i would like to have a property returning raw content casted to that interface.
  8. Hi, this is a test code that does exactly the same as my original code (it crashes too). package { import flash.display.Sprite; import flash.geom.Point; public class TimelineMaxTest extends Sprite { public function TimelineMaxTest() { var menu:Menu; var i:int = 6, anchor:Point = new Point(); while( --i != 0 ) { menu = new Menu(); menu.y = anchor.y; addChild( menu ); anchor.y += 36; } } } } package { import com.greensock.TimelineMax; import com.greensock.TweenLite; import flash.display.Shape; import flash.display.Sprite; import flash.events.MouseEvent; public class Menu extends Sprite { private var timeline:TimelineMax; private var over:Boolean; private var background:Shape; public function Menu() { super(); graphics.beginFill( 0x00FFFF, 1 ); graphics.drawRect( 0, 0, 265, 36 ); graphics.endFill(); background = new Shape(); background.graphics.beginFill( 0xA10000, 1 ); background.graphics.drawRect( 0, 0, 265, 36 ); background.graphics.endFill(); background.width = 0; background.alpha = 0; addChildAt( background, 0 ); timeline = new TimelineMax(); timeline.append( new TweenLite( background, .4, { alpha: 1, width: 500 } ) ); timeline.stop(); addEventListener( MouseEvent.ROLL_OVER, this_mouseEventHandler ); addEventListener( MouseEvent.ROLL_OUT, this_mouseEventHandler ); } private function this_mouseEventHandler( $event:MouseEvent ):void { switch ( $event.type ) { case MouseEvent.ROLL_OVER: { timeline.play(); break; } case MouseEvent.ROLL_OUT: { timeline.reverse(); break; } } } } } I'm using the latest version of TimelineMax. After a crash the Flex Debugger shows that the script execution time has exceeded in class SimpleTimeline, function renderTime, on "while (tween)". It happens on both Mac and Windows if it matters, i'm compiling in Flex Builder.
  9. Hello, in my ongoing project i'm building animated menu using TimelineLite - main idea is to play and reverse timeline on mouse events. I create few instances of Menu class, and play them with the mouse hard (multiple rollovers and rollouts). At first it plays smooth, then some of instances stop responding to mouse events and finally Flash Player crashes. Here is my Menu class. Is this the problem with TimelineLite or am i doing it wrong? package { import assets.MenuClip; import com.greensock.TimelineLite; import com.greensock.TweenLite; import flash.display.Shape; import flash.events.MouseEvent; import flash.text.TextFieldAutoSize; public class Menu extends MenuClip { private var timeline:TimelineLite; private var over:Boolean; private var background:Shape; public function Menu( $data:XML ) { super(); graphics.beginFill( 0x00FFFF, 1 ); graphics.drawRect( 0, 0, 265, 36 ); graphics.endFill(); tf.autoSize = TextFieldAutoSize.LEFT tf.text = $data.title; background = new Shape(); background.graphics.beginFill( 0xA10000, 1 ); background.graphics.drawRect( 0, 0, 265, 36 ); background.graphics.endFill(); background.width = 0; background.alpha = 0; addChildAt( background, 0 ); timeline = new TimelineLite(); timeline.append( new TweenLite( background, .4, { alpha: 1, width: 500 } ) ); timeline.stop(); addEventListener( MouseEvent.ROLL_OVER, this_mouseEventHandler ); addEventListener( MouseEvent.ROLL_OUT, this_mouseEventHandler ); } private function this_mouseEventHandler( $event:MouseEvent ):void { switch ( $event.type ) { case MouseEvent.ROLL_OVER: { timeline.play(); break; } case MouseEvent.ROLL_OUT: { timeline.reverse(); break; } } } } }
×