Jump to content
Search Community

Chrysto last won the day on August 13 2014

Chrysto had the most liked content!

Chrysto

Business
  • Posts

    172
  • Joined

  • Last visited

  • Days Won

    15

Everything posted by Chrysto

  1. I have several gams writeen in AS3 and compiled to *.ipa, TweenLite works great for me, it is better than Caurina's Tweener and the Flash native tweening engine. I reccomand it , and always make sure you remove the listeners (not using weak ref), in my opininon this is the thing that fu*cks up most AS3 apps for iOS
  2. hi; I use another way of sizing my DisplayObjects, let me share it with you: public function set _x(value:* ):void{ if (this.parent) { if (value == "left"){ super.x = 0; } else if ( value == "right" ){ super.x = this.parent.width - this.width; } else if ( value == "center" ){ super.x = NumberTools.center(this.parent.width, this.width); } else if ( value is String && value.match(/%$/)){ super.x = (Number(value.match(/([0-9\.\-]+)%$/)[1]) / 100) * this.parent.width; } else if ( value is Function ){ super.x = (value as Function).apply(this); } else{ super.x = value; } this._delayed_params.remove("_x"); }else { this._delayed_params._x = value; } _resize_params["_x"] = value; } /* easy "y" manipulation pass string (top/bottom/center) or "100%" , or function that returns number */ public function set _y(value:* ):void { if (this.parent) { if (value == "top"){ super.y = 0 } else if ( value == "bottom" ){ super.y = this.parent.height - this.height; } else if ( value == "center" ){ super.y = NumberTools.center(this.parent.height, this.height); } else if ( value is String && value.match(/%$/)){ super.y = (Number(value.match(/([0-9\.\-]+)%$/)[1]) / 100) * this.parent.height; } else if ( value is Function ){ super.y = (value as Function).apply(this); } else{ super.y = value; } this._delayed_params.remove("_y"); }else { this._delayed_params._y = value; } _resize_params["_y"] = value; } /* width manipulation --> pass string ("100%") or functon that returns number */ public function set _width(value:* ):void { if (this.parent) { if ( value is String && value.match(/%$/)){ super.width = (Number(value.match(/([0-9\.\-]+)%$/)[1]) / 100) * this.parent.width; } else if (value is Function){ super.width = (value as Function).apply(this); } else{ super.width = value; } this._delayed_params.remove("_width"); }else { this._delayed_params._width = value; } _resize_params["_width"] = value; } /* height manipulation --> pass string ("100%") or functon that returns number */ public function set _height(value:* ):void { if (this.parent) { if ( value is String && value.match(/%$/)){ super.height = (Number(value.match(/([0-9\.\-]+)%$/)[1]) / 100) * this.parent.height; } else if ( value is Function ){ super.height = (value as Function).apply(this); } else { super.height = value; } this._delayed_params.remove("_height"); }else { this._delayed_params._height = value; } _resize_params["_height"] = value; } for example you can pass for "x" propert the values: "100%" - will set it up 100% ot it's parent "center" - will center it function():Number{ return //some calculations } etc...
  3. Hi; Sometimes a client come and asks you "what if this picture is a little big bigger" , or "I'm sure it will looks better if this button was 10 pixels right from..." For all of you, who have the awsome TransformManager, here's little snipper for you: package bassta.debug { import com.greensock.transform.TransformManager; import com.greensock.events.TransformEvent; import com.greensock.transform.TransformItem; import flash.display.DisplayObject; import flash.display.DisplayObjectContainer; import flash.display.Sprite; public class MagicDebugger { private static var t:TransformManager; private static var c:Vector. = new Vector. public function MagicDebugger() { throw new Error("Use only with it's static methods"); } public static function create(debuggedObject:DisplayObjectContainer):void{ if(c.indexOf(debuggedObject) == -1){ c.push(debuggedObject); t = new TransformManager(); t.allowDelete = true; t.allowMultiSelect = true; t.arrowKeysMove = true; t.forceSelectionToFront = false; t.lockScale = false; t.scaleFromCenter = false; var i:int = debuggedObject.numChildren; for ( i >= 0; i--; ) { var s:DisplayObject = debuggedObject.getChildAt(i); t.addItem(s); t.getItem(s).addEventListener(TransformEvent.FINISH_INTERACTIVE_MOVE, outputChange); t.getItem(s).addEventListener(TransformEvent.FINISH_INTERACTIVE_ROTATE, outputChange); t.getItem(s).addEventListener(TransformEvent.FINISH_INTERACTIVE_SCALE, outputChange); t.getItem(s).addEventListener(TransformEvent.MOVE, outputChange); } } else { trace("Duplication Found"); } } private static function outputChange(event:TransformEvent):void{ var currentItem:TransformItem = (event.currentTarget as TransformItem); trace("Child [ " + currentItem.targetObject.name + " ] with bounds: { x: " + Math.ceil(currentItem.x) + ", y:" + Math.ceil(currentItem.y) + ", width: " + Math.ceil(currentItem.width) + ", height: " + Math.ceil(currentItem.height) + ", rotation: " + Math.ceil(currentItem.rotation) + " }"); } public static function releaseManager():void{ t.destroy(); c.splice(0,c.length); } //getter, return the manager public static function manager():TransformManager{ return t; } }//end } Demo: http://burnandbass.com/demo15/ Just use MagicDebugger.create(this.stage) for example and transform all children of the stage The code does not do recursion, so only the childs (not their inner childs) will be applied for the manager For more snippers - check me in http://www.facebook.com/bassta If you are developing websites using SWFAddress, stay tuned for my "bassta debugger", demo - http://burnandbass.com/maggi (upper left corner), it has memory monitor, flash logging (DebugPanel.log(message), use it instead of (trace) for browser testing), grawl like notifications, rulers and many more things to come
  4. What di you mean by tweening scale9grid? It is attached to the MovieClip (or sprite ) so you don't think about resizing and can tween it any way. Take a loook at http://burnandbass.com/tScroller.swf , this is an simple multi-purpose scroller I build couple of years ago. It uses scale9grid for handlebar and the track. You may need to resize your screen to view it in action
  5. I suggest you yo use scale9grid, it works perfect for me . var mySprite : Sprite = new Sprite(); mySprite.graphics.beginFill(0xff0000); mySprite.graphics.lineStyle(2, 0x00ff00); mySprite.graphics.drawRoundRect(0, 0, 200, 200, 50); mySprite.graphics.endFill(); mySprite.x = 100; mySprite.y = 100; this.addChild(mySprite); mySprite.scale9Grid = new Rectangle(60, 60, 100, 100);
  6. Write me a PM what exatly do you want to modify
  7. it is, jst change the type from ImageLoader to SWFLoader... If you need to have this with multiple SWF files (instead of images) I'll rewrite it for you, just tell me do you need them for CS3 or CS5..
  8. Hi, I'm happy to announce free fullscreen sliding gallery demo available at http://burnandbass.com/sliding_fullscreen_gallery/ download at http://burnandbass.com/sliding_fullscre ... allery.zip Opens with CS3, CS4, CS5 (cs3 demo without preloader)... Just pass array of image urls (I did the demo with XML, the code is fully documented) and it will load it for you, dispatches events on slide starts/finished. This is the same script I used for http://burnandbass.com/maggi/#/en/colle ... eli-kolie/ this gallery The code is well documented, also in the zip there's pdf file with demo code and all available options. The API includes goNext, goPrevious and gotoSlide functionality. About licensing - feel free to use in all kind of projects, comeercial or not Just keep the greensock's license
  9. Just make new Flash CS3 file and assing the document class to Main , everything should work fine
  10. 10x, I got a lot of unreleased code/experiments and I think it will be great if GreenSock make whole sub-forum only for sharing code that uses tweenlite/max/loader
  11. happy new year I am glad to share with you a component I wrote mounths ago and added some finishing touches today It is images slider that changes (slided/fades) images depend on the mouse position - devide the stage of the number of the images and switch between them when you move your mouse. The classes automaticly devides the stage into zones (you got as many zones as pictures you pass) Demo you can see at: http://burnandbass.com/mousesteps/fading/ --> fading them, the segments are visible. If you got images of an object from different angle you can make some really good effects. http://burnandbass.com/mousesteps/slidi ... slide.html --> sliding (without lines visible) ( Btw I used the same script for this gallery: http://burnandbass.com/maggi/#/en/colle ... eli-kolie/ , just added AutoFitArea for the fullscreen ) http://burnandbass.com/mousesteps/slidi ... slide.html --> with lines visible The documented source avalable at http://burnandbass.com/mousesteps/mouse ... slider.zip The classes uses TweenLite and LoaderMax The shoe on the pic is Supra Skytop White Tuf avalable at http://www.stepupshop.eu/supra-skytop-white-tuf.html Enjoy
  12. http://burnandbass.com/maggi/#/en/colle ... eli-kolie/ --> Here is small unfinished project , it is in debug mode (yellow triangle in tje top left). It uses greensock's transforming classes , SWFAddress, multilangual
  13. Strange, I make it working, i din't figured out what is the problem, but it seems that the methods are ot working with obects directly placed on stage EVEN IF they're declared like public variables in the application class. However, if you dynamicly add object, it is working.... The code that worked for me is: --> in the loaded swf application class: public var bys:bySprite = bySprite.newRect({width:100,height:100, color:"cyan"}); //it uses my drawing API, just to visiulize some simple square public function LoadedMain() { //constructur function addChild(bys); --> in the class with the loader, after loading is finished: public var a:SWFLoader = new SWFLoader("loadedswf.swf"); and ater it completes loading: (a.rawContent.bys as bySprite).addEventListener(MouseEvent.CLICK, function():void{trace("yabaaaaaaaaa")});
  14. Yes, but none of the code is working for me... In the timeline I got MovieClip called "pink_mc" the loaded class: package { import flash.display.MovieClip; import flash.events.MouseEvent; import flash.events.Event; import flash.display.DisplayObject; public class LoadedMain extends MovieClip { public var pink_btn:MovieClip; public function LoadedMain() { pink_btn.addEventListener(MouseEvent.CLICK, function():void{ trace("working"); }); } }//end } this is working perfectly In the SWF I'm loading to: package { import com.greensock.loading.LoaderMax; import com.greensock.loading.SWFLoader; import com.greensock.events.LoaderEvent; import flash.events.Event; import flash.display.MovieClip; import flash.display.DisplayObject; import flash.events.MouseEvent; public class Main extends MovieClip{ private var a:SWFLoader = new SWFLoader("loadedswf.swf"); public function Main() { a.addEventListener(LoaderEvent.COMPLETE, onComplete); a.load(); } private function onComplete(e:LoaderEvent):void{ trace("loaded"); addChild( a.content); var s:DisplayObject = a.getSWFChild("pink_mc"); s.addEventListener(MouseEvent.CLICK, function():void{trace("yabaaaaaaaaa")}); // trace(a.content.getSWFChild("pink_mc") trace(a.getSWFChild("pink_mc") } }//end } They both return null (it is said in the documentation they will) , but when I try to addEventListeners to them it gives me error: var mk:DisplayObject = a.getSWFChild("pink_mc"); mk.addEventListener(MouseEvent.CLICK, function():void{trace("yabaaaaaaaaa")}); gives me l oaded TypeError: Error #1009: Cannot access a property or method of a null object reference. at Main/onComplete() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at com.greensock.loading.core::LoaderCore/_completeHandler() at com.greensock.loading::SWFLoader/_completeHandler()
  15. Hi, I have an splashscreen with some animation and button at the end of the animation. It is about 300k, so I want to make it another SWF file, load it, and unload it when it is no longer needed. The problem is - I have to access the buton inside the loaded swf. I can't make it happen, I have the button at the stage with name pink_mc, at the loaded swf document class I put public var pink_mc:MovieClip... When I load with Loader Max I can't access it via var m:MovieClip = loader.content m.pink_mc.addEventListener.... gives me error : there's not such a variable. Any suggestions? And I will appriciate if somebody can help me with calling function onto parent swf - the one that loads the splash screen
  16. Woops, some other stuff: http://www.toshiedo.com.au/ 's g-star microsite. I'm not sure if I was using tweenLite or Tweener for the tweens, but it is changing couple lines of code anyway http://burnandbass.com/sangria/#/event/ --> Old microsite of a party http://petrabg.com/#/en/ --> some serious deep linking All code (except petra, this is commercial) avalable by request
  17. Here is some old stuff, I done using Green Sock classes: http://burnandbass.com/imageencoding/ImagePuzzle.swf This is basicly xml driven magazine covers (or it supposed to be, never finished it) editor... It features multiple categories, text, transform items bar, canvas , image/xml exporting ... I also added right-click menu to every transform item. If somebody is interested in this fetures I can send him the extra code I added
  18. Hi, Recently I did an online demotivational poster making tool. It needs some finishing touches and is not online now, but the pic upload works perfectly... If you want I can help you with this part. I use AS3 only so when you purchuse the transform manager AS3 I can give you some of my code and help you with your app... Here is some of my code: private var jagFileRefSave:FileReference = new FileReference(); private var loader:Loader = new Loader(); private var imagesFilter:FileFilter = new FileFilter("Images", "*.jpg;*.gif;*.png", "*.JPG"); //in constructur function: upload_Image.addEventListener(MouseEvent.CLICK,onClickSave); private function onClickSave(e:MouseEvent):void{ jagFileRefSave.browse([imagesFilter]); jagFileRefSave.addEventListener(Event.SELECT, selectedFile); } private function selectedFile(e:Event):void{ jagFileRefSave.load(); jagFileRefSave.addEventListener(Event.COMPLETE, loaded); jagFileRefSave.addEventListener(ProgressEvent.PROGRESS, onProgress); } private function onProgress(e:ProgressEvent):void{ trace( String( Math.ceil( ( e.bytesLoaded/e.bytesTotal)*100)) + " %loaded"); } private function loaded(e:Event):void{ var rawBytes:ByteArray = jagFileRefSave.data; jagFileRefSave.removeEventListener(ProgressEvent.PROGRESS, onProgress); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, getBitmapData) loader.loadBytes(rawBytes); } private function getBitmapData(e:Event):void{ loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, getBitmapData) this.image = new Bitmap( (loader.content as Bitmap).bitmapData ); this.imageAspect = new Aspect(image.width, image.height); if(image.width >= image.height ){ Settings.IMAGE_MODE = "horizontal"; } else { Settings.IMAGE_MODE = "vertical" } trace(Settings.IMAGE_MODE + " --> Settings.IMAGE_MODE"); addChild(image); init(); } If you need help just drop me a PM
  19. Basicly I need to know if object is flipped verical (or horizontal) or not. Is it implemented in the transform manager?
  20. Hi; I'm building simple application where I need to have flipping horizontal and vertical functionality and than to record each step. on http://burnandbass.com/imageencoding/ImagePuzzle.swf is some very basics - how I can track and record if item is flipped (by using right click context menu)
×
×
  • Create New...