Hulio
Members-
Posts
16 -
Joined
-
Last visited
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Everything posted by Hulio
-
So true, I didn't even think about that. Thanks mate!
-
Allright, here's the code package { import com.greensock.TweenMax; import com.greensock.easing.Quad; import com.greensock.events.LoaderEvent; import com.greensock.loading.ImageLoader; import com.greensock.loading.LoaderMax; import com.greensock.plugins.AutoAlphaPlugin; import com.greensock.plugins.TweenPlugin; import flash.display.BlendMode; import flash.display.Sprite; import flash.text.AntiAliasType; import flash.text.Font; import flash.text.StyleSheet; import flash.text.TextField; import flash.text.TextFieldAutoSize; TweenPlugin.activate([AutoAlphaPlugin]); LoaderMax.activate([imageLoader]); public dynamic class Main extends Sprite { // DEFINE THE VARIABLES // LOADER CONTENT private var preloader : LoaderMax; // STAGE ELEMENTS private var font_times : Font = new Times(); private var format_preloader : StyleSheet; private var mc_preloader : Sprite; private var preloader_indicator : Sprite; private var preloader_txt : TextField; private var container : Sprite; public function Main() { // DEFINE THE TEXT FORMATS format_preloader = new StyleSheet(); format_preloader.setStyle("p", {fontFamily : font_times.fontName, fontSize : 12, color : "#FFFFFF"}); // DEFINE THE PRELOADER CONTENT mc_preloader = new Sprite(); mc_preloader.graphics.beginFill(0xAAAAAA); mc_preloader.graphics.drawRect(0, 0, stage.stageWidth, 14); mc_preloader.graphics.endFill(); // ADD THE PRELOADER INDICATOR preloader_indicator = new Sprite(); preloader_indicator.graphics.beginFill(0xCCCCCC); preloader_indicator.graphics.drawRect(0, 0, stage.stageWidth, 14); preloader_indicator.graphics.endFill(); mc_preloader.addChild(preloader_indicator); // ADD THE PRELOADER TEXT preloader_txt = create_textfield(mc_preloader, null, null, format_preloader, false, false, 100, "center", 1); // DEFINE THE PRELOADER DATA preloader = new LoaderMax({name: "preloader_data", autoDispose: true, onOpen: preload_open, onProgress: preload_progress, onComplete: preload_complete, onError: preload_error}); preloader.append( new ImageLoader("images/photo_1.jpg", {name: "photo_1", estimatedBytes: 500}) ); preloader.append( new ImageLoader("images/photo_2.jpg", {name: "photo_2", estimatedBytes: 100}) ); preloader.append( new ImageLoader("images/photo_3.jpg", {name: "photo_3", estimatedBytes: 500}) ); preloader.load(); // CREATE A PRELOADING OPEN FUNCTION function preload_open(event : LoaderEvent) : void { // ADD THE PRELOADER TO STAGE addChild(mc_preloader); mc_preloader.y = stage.stageHeight / 2; preloader_indicator.width = 0; } // CREATE A PRELOADING FUNCTION function preload_progress(event : LoaderEvent) : void { preloader_indicator.width = preloader.progress * stage.stageWidth; preloader_txt.htmlText = ' ' + Math.round(preloader.progress * 100) + ' %'; preloader_txt.x = stage.stageWidth / 2; } // CREATE A PRELOADING ERROR FUNCTION function preload_error(event : LoaderEvent) : void { trace("Error: " + event.target + ": " + event.text); } // CREATE A PRELOADING COMPLETE FUNCTION function preload_complete(event : LoaderEvent) : void { TweenMax.to(mc_preloader, 0.5, {autoAlpha: 0, ease: Quad.easeOut}); container = new Sprite(); addChild(container); container.addChild(preloader.getContent("photo_1").rawContent); container.addChild(preloader.getContent("photo_2").rawContent); container.addChild(preloader.getContent("photo_3").rawContent); container.alpha = 0; TweenMax.to(container, 0.5, {alpha: 1, ease: Quad.easeOut, delay: 0.5}); } } protected function create_textfield(_container : Sprite, _name : String, _html : String, _style : StyleSheet, _multiline : Boolean, _wordwrap : Boolean, _width : Number, _align : String, _alpha : Number) : TextField { var _textfield : TextField = new TextField(); if (_name) _textfield.name = _name; if (_style) _textfield.styleSheet = _style; if (_width) _textfield.width = _width; _textfield.embedFonts = true; _textfield.multiline = _multiline; _textfield.wordWrap = _wordwrap; _textfield.selectable = false; _textfield.blendMode = BlendMode.LAYER; _textfield.antiAliasType = AntiAliasType.ADVANCED; var set_align : String = ''; if (_align == 'left') set_align = TextFieldAutoSize.LEFT; if (_align == 'center') set_align = TextFieldAutoSize.CENTER; if (_align == 'right') set_align = TextFieldAutoSize.RIGHT; _textfield.autoSize = set_align; _textfield.alpha = _alpha; if (_html) _textfield.htmlText = _html; if (_container) { _container.addChild(_textfield); } else { var _sprite : Sprite = new Sprite(); addChild(_sprite); _sprite.addChild(_textfield); } return _textfield; } } } Thanks for your reply!
-
Why is this happening? The value is 0, not 1, when it is fully loaded. /** A value between 0 and 1 indicating the overall progress of the loader. When nothing has loaded, it will be 0; when it is halfway loaded, progress will be 0.5, and when it is fully loaded it will be 1. **/ public function get progress():Number { return (this.bytesTotal != 0) ? _cachedBytesLoaded / _cachedBytesTotal : (_status == LoaderStatus.COMPLETED) ? 1 : 0; }
-
Oh my, this get too heavy for me sometimes...so many things to understand. Thanks so much once again, you're the best!
-
Nested or not, it loops only number zero, so I can't get the count increase. I'm sure it has something to do with the instance "this", I don't know where it is referring to. Everything is okay if I put this to the timeline on the same frame, but in the class it doesn't work...
-
Ok, now I'm having another problem here. I tried to convert this case to as3, but... (THE VARIABLES AT THE TOP OF THE DOCUMENT) private var mc_counter : Sprite; private var counter_txt : TextField; private var count : Number = 0; (AND THE FUNCTION AFTER LOADING PROCESS) function preload_complete(event : LoaderEvent) : void { mc_counter = new Sprite(); addChild(mc_counter); counter_txt = create_textfield(mc_counter, null, null, format_basic, false, false, 150, "center", 1); var current_sum : Number = 1000.20; TweenLite.to(this, 10, {count: current_sum, ease: Expo.easeOut, onUpdate: update_counter}); function update_counter() : void { counter_txt.htmlText = ' ' + count + ' \u20AC'; } } ...the counter doesn't do anything and I can't find out what's the problem. Thanks again! Where is "this" referring to? What should I use instead of it?
-
Oh, I got it! You're absolutely right..
-
Oh jeeeah, of course. Thanks man! Are u talking about this format_decimals -function there btw? If so, sorry for that, my mistake!
-
What am I doin' wrong here? Anyone please? The tween stops working inside this init-function..? What should I use as a target? function init() { var current_sum : Number = 120.20; var count : Number = 0.00; TweenLite.to(this, 10, {count: current_sum, ease: Expo.easeOut, onUpdate: function () { txt_counter.text = format_decimals(count, 2) + ' \u20AC'; }}); }
-
Ok, here we go, thank you so much...tough I'm pretty sure I trie this
-
Ok, it's monday and I think I should know this better, but I just can't. How do I loop all the ImageLoaders at once under the LoaderMax -node in XML? Somehow I just can't get the lenght fetched no matter what I do... Here's what I'm trying to do: var xml_preload_images = preloader.getContent("general_images"); for (var i : int = 0; i <= xml_preload_images.lenght; i++) {... Thnks!
-
Ok, seems like drop shadow -filter makes the problem. Anyone having the same kind of issues with the filters?
-
I'm fighting with this issue to get a stack of pngs to scale from A to B. The tween gets very very heavy and it ain't smooth at all. The images aren't more than 40 kbs and there's 8 of them. No matter how I try to scale them by tweening them all together or separated, it's the same thing. What I'm I doing wrong here?
-
Yea, seems like it's an IDE issue after all. Thanks for your reply anyway!
-
Hi, I'm currently fighting with this issue via XML ImageLoader. It throws this only when trying to replay the movie: Loading error on ImageLoader 'image_1' (images/image_1.gif): Error #2036: Load Never Completed. URL: file:///Mac.../images/image_1.gif Here's the code I'm using: LoaderMax.activate([imageLoader]); xml_loader = new XMLLoader(root_url + "data.xml", {name: "xml_loader_data", requireWithRoot: this.root, estimatedBytes: 500}); css_loader = new CSSLoader(root_url + "styles.css", {name:"css_loader_data", requireWithRoot: this.root, estimatedBytes: 500}); preloader = new LoaderMax({name: "preloader_data", onProgress: preload_progress, onComplete: preload_complete, onError: preload_error}); preloader.append(xml_loader); preloader.append(css_loader); preloader.load(); And the XML looks like this: <?xml version="1.0" encoding="UTF-8"?> Thanks for your help!
-
Hi and thanks so much for the great job! I was just wondering if there's a little bug in ur "progress handlers", cuz when I'm using my own preloader ( with a percentage text ), it always "flashes" a full (completed) percent before the progress event even gets started. Is this a bug, or am I just doing something wrong? Thanks!