Jump to content

Search the Community

Showing results for tags 'BlitMask'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


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

Product Groups

  • Club GreenSock
  • TransformManager
  • Supercharge


There are no results to display.

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Personal Website



Company Website



  1. I am using copyPixels() to copy data from 12 large 3000x3600 bitmapData instances already loaded into memory. The data is being copied into a Bitmap which is the target for my BlitMask. I've tried all sorts of permutations of using bitmapData.dispose() but whatever I do everytime I use copyPixels on one of the instantiated images it adds about another 40Mb to my BlitMask (probably the size of the 8bit 3000x3600pixel image in cache) I try and force the garbage collection using System.pauseForGCIfCollectionImminent(0.01); but I only seem to increase the amount of memory being allocated. It is only when I dispose of the BlitMask that I can free up memory. Any ideas or should I try another approach? I have the feeling that because BlitMask caches the display object as a bitmapData object that it is also drawing in the cache created by the copyPixels() function. I am trying to make a music score scroller so I cannot interrupt the display of the image whilst the music is playing. Many Thanks
  2. Hello ... again. I read about the blitmask now, and it is (mostly) clear to me, that and why it's a rectangular sprite. Now...I am pretty sure, that it is possible to create a Bitmap Data object, that is built a little bit differently. I am not good enough to do it in AS though, and so I just like to discuss my idea with you guys. So, my theory is that the bitmap data object is a bit like a matrix filled with pixeldata. If there was a circular algorithm built in, one could - row after row - check out the needed pixels (opaque), and the ones we dont need (transparent) and thus build a circular blitmask. The same would then even work with elliptical shapes - divisionwise...on one of the x or y axis. Yeah...you know what I mean, eh? Well..yeah. That's it for now. Are you on that already? Is there some error in my idea? Is it already achievable with some of your great stuff? Is it silly implementing what AS3 can do (well...you do that all the time dont you? ) Let me know..I'm pretty darn curious. Peace! EDIT: I rethought and...is it a good thing to mask the blit-masked MC with a cirular shape. It doesnt seem that clean actually, hmm.....but the "normal" mask only masks a single and shrunk Bitmap then, and it could be performant. But I still think, that this is a rather dirty workaround, right?
  3. Hi there, working in flash cs6 and compiling to air iOS 3.4 Im testing out blitmask with a speed var controlled from a variable. in the ADL im hitting 60fps but on device only getting 24? At present I only have 1 movieclip on stage (mc) which is around 2000px in width, nothing else apart from fps monitor and buttons for speed control and a textfield for speed var. import com.greensock.*; import com.greensock.easing.*; /// stage.addChild(new movieMonitor()); /// var bMask = new BlitMask(mc,0,0,stage.stageWidth,stage.stageHeight,true,true,0,true); mc.cacheAsBitmap = true; bMask.enableBitmapMode(); bMask.bitmapMode = true /// var speed:Number = 10; var dist:Number = 10; var nums:Number = 1 mc.visible=false; addEventListener(Event.ENTER_FRAME, loop); function loop(e:Event):void { mc.x-=speed speedText.text = speed.toString(); } bubb1.addEventListener(MouseEvent.CLICK, dec) bubb2.addEventListener(MouseEvent.CLICK, inc) function dec(e:MouseEvent){ speed-- } function inc(e:MouseEvent){ speed ++ } I have seen the blitmask demo and the videos showing 60fps even on a iphone 3gs so I must be doing something wrong. btw I am using GPU render (although I did try others) Thanks Phil
  4. Hi, I am having issues with random stuttering while scrolling an image. I am creating a simple panorama image viewer, The image is loaded in via LoaderMax as well as settings related to scrollSpeed wrapEnabled etc.. Basically I load in the image, add it to a movieClip and then add the MovieClip to a BlitMask and then tween the scrollX value of the blitMask. Once I set the fps to 60 the tween is nice and smooth 90% of the time but every now and again it stutters for 2-5secs then goes fine again. I am using a few images I found on google images as test cases, and none are extremely large (around 1500x500px). I have created a very simple example that recreates the stuttering. Just hold the mouse down to scroll. It happens every 10 secs or so. Here is a link to the fla, it is in Google Drive which tries to open the file, but gives a download link once that fails. (the attach option in the post topic wouldn't accept it?) https://docs.google.com/open?id=0B4XU51X_f9wCT0d0aFhIY0V3akE I'm hoping I am just doing something wrong rather than it being something outside my control e.g. Garbage Collection. I should note, that it has to run on Flash Player 9, Thanks!
  5. Hi, is it possible to BlitMask a MovieClip with buttons in it ? it seems to disable all MouseEvents when I apply it
  6. So I have been searching for a way to have a background orbit a center. I came across the greensock blitmask that does an amazing job of wrapping the bitmap data to do infinte scrolling effects. However, I can't figure out a way to use this blitmask to rotate and still have the wrapping effect. I attached a SWF file to demostrate what i'm trying to accomplish. WASD keys control the movement cosc469.zip
  7. Hi, how would I change a dynamic text after I use blitmask blitMask = new BlitMask(this, x, y, width, blockHeight * 5, false, true, 0xFFFFFF, true); I tried to: blitMask.disableBitmapMode(); dynamicText.text = "BLABLA"; blitMask.enableBitmapMode(); blitMask.dispose(); dynamicText.text = "BLABLA"; blitMask = new BlitMask(this, x, y, width, blockHeight * 5, false, true, 0xFFFFFF, true); but nothing works. Any advice on how I can achieve this?
  8. Hello, I´m trying to make a simple pinch zoom image scroll app in Adobe Air Mobile for Android and ios. I always having the same issue when I try to pinch the image zoom in and I activate the blitmask. I don´t have problems making this part. But when I pinch to zoom out, the image moves to different x and y coordinates, and sometimes the image disappears. IThe image upon zoom out moves off-center and doesn´t return to position zero. I know there is something in the blitmask that changes these values, but I´m not sure what exactly is going wrong. I always use blitmask.update() and enable or disable bitmapMode. Does anyone have an example for Flash with pinch zoom gestures with ThrowProps + blitMask? Thanks.
  9. I have a simple rectangular movieclip, say 40px wide and 1000px tall. I use a 40 by 200px BlitMask on it, and tween (with TweenMax) the movieclip down. Works fine. But if I apply a blurFilter to the tween, with a blurY of say 10px, then when I tween the blur extends OUTSIDE (above and below) the BlitMask. I want the blur to be masked by the BlitMask - i.e. I want the blur, but still want it masked to the 200px height of my BlitMask. Obviously I must be doing something wrong. Anyone have the solution? Thanks in advance! Greg
  10. Hello. Say you create a sprite and are using a BlitMask on that sprite: private var scrollerSprite:Sprite = new Sprite(); private var scrollerBlit:BlitMask; scrollerBlit = new BlitMask(scrollerSprite, 0, 0, scrollerWidth, scrollerHeight, true, true, 0x000000); scrollerBlit.wrap = true; All happy. Now, let's say later on you need to add children to scrollerSprite: scrollerSprite.addChild(Item); That item will not appear for me, it's being masked by the BlitMask. How can I resolve this? I'm updating the mask after adding the child, but this makes no difference. Thanks.
  11. hello, i am download a sample code from snorkl.tv slot machine i am as per my trying i want to add another text or may replace one number at run time for example at run time i want to change 3->11 so how i do in this sample i try but its not change at run time so please help me in this blitmask animation thanks
  12. I have implemented throwprops functionality.also I am using blit mask but when I Implement scrolling using blit mask I want that user scroll using Blank area covered by blitmask i want that it should scroll. I tried to set hitArea of Blit mask but then It stopped working. TweenPlugin.activate([ThrowPropsPlugin]); public class ScrollingTest extends Sprite { var layoutManager:HLayout; var itemVector:Vector.<ComplexItem> ; var rc:int; var mainContainer:Sprite; var itemList:Sprite; var _scrollMask:Sprite; var bm:BlitMask; var backgroundLoader:Loader; public function ScrollingTest() { MonsterDebugger.initialize(this); init(); } var bounds:Rectangle; public function init():void { bounds = new Rectangle(0,0,1280,720); rc = 0; itemList = new Sprite(); itemList.y = 100; itemVector = new Vector.<ComplexItem>(); layoutManager = new HLayout(); layoutManager.hAlign = Align.LEFT; layoutManager.vAlign = Align.TOP; layoutManager.hGap = 100; layoutManager.vGap = 100; layoutManager.maxItemsPerRow = 50; for (var i:int=0; i<100; i++) { var complex:ComplexItem = new ComplexItem(); complex.addEventListener(MouseEvent.CLICK,onItemClick); complex.addEventListener(Event.COMPLETE,resourceLoaded); complex.startLoad(); itemVector.push(complex); rc++; } backgroundLoader = new Loader(); backgroundLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,onImageLoaded); backgroundLoader.load(new URLRequest("bigback.png")); } private function onImageLoaded(event:Event):void { var bmp:Bitmap = new Bitmap(event.target.content.bitmapData); addChildAt(bmp,0); } private function resourceLoaded(event:Event):void { rc--; if (rc == 0) { for (var i:int=0; i<itemVector.length; i++) { layoutManager.add(itemVector[i]); } layoutManager.layout(itemList); itemList.name = "ItemListContainer"; addChild(itemList); _scrollMask=new Sprite(); _scrollMask.name = "scrollMask"; _scrollMask.x = 100; _scrollMask.y = 0; _scrollMask.graphics.beginFill(0xFFFFFF,0.5); _scrollMask.graphics.drawRect(0,0,1000,600); _scrollMask.graphics.endFill(); _scrollMask.visible = false; bm = new BlitMask(itemList,100,0,1000,650,false,true); bm.addEventListener(MouseEvent.MOUSE_DOWN,mouseDownHandler); itemList.hitArea = _scrollMask; itemList.addEventListener(MouseEvent.MOUSE_DOWN,mouseDownHandler); dispatchEvent(new Event(Event.COMPLETE)); } } var t1:uint,t2:uint,x1:Number,x2:Number,xOverlap:Number,xOffset:Number; var beforeDragPos:Number; function mouseDownHandler(event:MouseEvent):void { if(isMoving==true) { isCatched=true; isMoving=false; } beforeDragPos = event.stageY; TweenLite.killTweensOf(itemList); x1 = x2 = itemList.x; xOffset = this.mouseX - itemList.x; xOverlap = Math.max(0,itemList.width - bounds.width); t1 = t2 = getTimer(); itemList.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); itemList.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } var isMoving:Boolean=false; var isCatched:Boolean=false; function mouseMoveHandler(event:MouseEvent):void { var moveX:Number = event.stageX - beforeDragPos; trace(moveX); if(moveX<0) { moveX=moveX * 1; } if(moveX < 20) { isMoving = false; return; } else { isMoving= true; } var x:Number = this.mouseX - xOffset; //if mc's position exceeds the bounds, make it drag only half as far with each mouse movement (like iPhone/iPad behavior) if (x > bounds.top) { itemList.x = (x + bounds.top) * 0.5; } else if (y < bounds.top - xOverlap) { itemList.x = (x + bounds.top - xOverlap) * 0.5; } else { itemList.x = x; } bm.update(); var t:uint = getTimer(); //if the frame rate is too high, we won't be able to track the velocity as well, so only update the values 20 times per second if (t - t2 > 50) { x2 = x1; t2 = t1; x1 = itemList.x; t1 = t; } event.updateAfterEvent(); } function mouseUpHandler(event:MouseEvent):void { itemList.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); itemList.stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); var time:Number = (getTimer() - t2) / 1000; var xVelocity:Number = (itemList.x - x2) / time; ThrowPropsPlugin.to(itemList, {throwProps:{ x:{velocity:xVelocity, max:bounds.top, min:bounds.top - xOverlap, resistance:300} }, onUpdate:bm.update,onComplete:tweenComplete ,ease:Strong.easeOut }, 10, 0.3, 1); } private function tweenComplete():void { isMoving=false; isCatched=false; bm.bitmapMode = false; } public function onItemClick(e:Event):void { if(isMoving==false && isCatched==false) { e.currentTarget.visible = false; } }
  13. I Implemented throwprops functionality as described on site with use of blitmask. same exact example shown on the site. now My problem is i want to prevent clicking items . when Scrolling is running. Here is my senario. I have A Sprite container. MainContainer. addChild(itemPenel) I add Item Panel as Child to MainContainer and Applying Scroll functionality to it with code described on the site using ThrowPorps Plugin. item penel have following structure. ItemPanel ( item Panel Contain Child Items ) --Item1 --Item2 --item3 --Item4 problem is when I scroll and when scroll is running I want that user is able to speed up the Scroll process by Accelerate it using drag but i dont want that he clicks any of item in the Item Panel. Also when I want to scroll by flick on Item ItemPenel should scroll but item should not be clicked its bugging me from lot of days Thanks.
  14. Hey all, It might just be really late but I'm stumped at the moment on a small blitMask problem. I've got a blitMask which masks out a lot of movieclips with click events on them. I've got the scrolling working great with the buttons in the blitMask but I can't click on any of them. I think the blitMask is intercepting the clicks and not letting them go through to the buttons but I'm not quite sure what I'm doing here. No more Tequila and coding I think. Cheers -Z
  15. Hi all, New member to the GreenSock club so be nice I use Flex (v4.6) and was trying to use the BlitMask. Naturally ran into no addChild. To fix the addChildAt problem copy the code from the MotionBlurPlugin (or elsewhere) if (_isFlex && _target.parent.hasOwnProperty("addElement")) { //to accommodate Flex 4 API additions (_target.parent as Object).addElementAt(this, (_target.parent as Object).getElementIndex(_target)); } else { _target.parent.addChildAt(this, _target.parent.getChildIndex(_target)); } and set _isFlex by adding (to the constructor) try { _isFlex = Boolean(getDefinitionByName("mx.managers.SystemManager")); // SystemManager is the first display class created within a Flex application } catch (e:Error) { _isFlex = false; } Also, one for others greater than I to ponder. The BlitMask currently extends Sprite, which doesn't have addElement anyway, so changed to DisplayObject, only to find it doesn't have Graphics. This site: http://www.hulstkamp...t-in-flex-4/555 suggested SpriteVisualElement, and it seems to work. Not sure if this can be modified into the release, but hope this helps some out there. Thanks Mr. GreenSock - terrific tools! AM - sorry for lack of color.
  16. I'm running into an issue with blitmask and a horizontal page-by-page scroller. As soon as I mousedown, the container with the masked content seems to shift vertically to a random position, and every time I move the mouse it changes the vertical position of the to some other seemingly random position. The app is designed for iPad, but it runs into the same issue on desktop AIR as well. It seems as though it may have something to do with my content, which was pasted into a FLA from Illustrator. Has anyone run into an issue like this before?
  17. hi i have a button on stage with a movieclip in it _view and a blitmask after the tween i need to get rid of blitmask and enable button mode. TweenMax.to(_view, 1, {y:0, onStart:_bMask.enableBitmapMode, onUpdate:_bMask.update, onComplete:animateInComplete, ease:Elastic.easeOut, easeParams:[0.2, 0.7], delay:1}); private function animateInComplete():void { _bMask.disableBitmapMode(); _bMask.dispose(); _bMask = null; enableThis(); } i still don't get the mouseevents for the button. can someone tell me howto do it? thanks
  18. Hi, If anyone is up for a challenge, I'm having real trouble with the scrollX settings for BlitMask. I'm trying to scroll the identical contents of two Blitmasks, placing them side-by-side and offsetting one. Here's an example class: package { import com.greensock.BlitMask; import com.greensock.easing.Linear; import com.greensock.TweenMax; import flash.display.Sprite; import flash.events.Event; import flash.text.TextField; import flash.text.TextFormat; public class Main extends Sprite { private const W:int = 300; private const S:int = 350; private const C:int = 10; private var img1:Sprite; private var img2:Sprite; private var img3:Sprite; private var txt1:TextField; private var txt2:TextField; private var txt3:TextField; private var blit1:BlitMask; private var blit2:BlitMask; private var blit3:BlitMask; public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); // entry point img1 = new Sprite(); img1.graphics.beginFill(0xff0033); img1.graphics.drawRect(0, 0, 3500, 200); img1.graphics.endFill(); addChild(img1); txt1 = new TextField(); txt1.text = "X1 X2 X3 X4 X5 X6 X7 X8 X9 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X0" txt1.width = 1750; txt1.scaleX = txt1.scaleY = 1.9; txt1.setTextFormat(new TextFormat("Arial", 100, 0, true)); img1.addChild(txt1); img2 = new Sprite(); img2.graphics.beginFill(0xff0066); img2.graphics.drawRect(0, 0, 3500, 200); img2.graphics.endFill(); addChild(img2); txt2 = new TextField(); txt2.text = "X1 X2 X3 X4 X5 X6 X7 X8 X9 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X0" txt2.width = 1750; txt2.scaleX = txt2.scaleY = 1.9; txt2.setTextFormat(new TextFormat("Arial", 100, 0, true)); img2.addChild(txt2); img3 = new Sprite(); img3.graphics.beginFill(0xff3399); img3.graphics.drawRect(0, 0, 3500, 200); img3.graphics.endFill(); addChild(img3); txt3 = new TextField(); txt3.text = "X1 X2 X3 X4 X5 X6 X7 X8 X9 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X0" txt3.width = 1750; txt3.scaleX = txt3.scaleY = 1.9; txt3.setTextFormat(new TextFormat("Arial", 100, 0, true)); img3.addChild(txt3); blit1 = new BlitMask(img1, 0 , 0, 300, 200, false, true, 0, true); blit2 = new BlitMask(img2, 350, 0, 300, 200, false, true, 0, true); blit3 = new BlitMask(img3, 0, 200, 700, 200, false, true, 0, true); var b1_offset:int = 0; var b2_offset:int = 1; var b1_end:Number = 1 - (W / S * C) var b2_start:Number = (W / S * C); TweenMax.fromTo(blit1, 10, { scrollX:0 }, { scrollX:b1_end, ease:Linear.easeNone } ); TweenMax.fromTo(blit2, 10, { scrollX:b2_start }, { scrollX:1, ease:Linear.easeNone } ); //need to match this: TweenMax.fromTo(blit3, 10, { scrollX:0 }, { scrollX:1, ease:Linear.easeNone } ); } } } So the aim is to make the contents of the top two BlitMasks match the third by offsetting the end position of blit1 (b1_end) and the start position of blit2 (b2_start). Only it doesn't work how I would expect & I can't get my head around it. Fabulous prizes to anyone who can help
  19. Hi guys, has anyone else had this problem or know of why it might be happening? Im building a simple recipe app for a client of ours and using loadermax to load the xml and images etc, its going to be on android and iphone. i'm loading my images like this, into a cropped area: queue.append( new ImageLoader(imagePath+imageURL, {name:elementID, estimatedBytes:40000, container:listElementContainer, alpha:1, height:300, width:640, scaleMode:"proportionalOutside", crop:"true"}) ); Then after everythings finished loading im using blitmask and making the page scrollable: pageScroll = new BlitMask(scrollPageTarget, bounds.x, bounds.y, bounds.width, bounds.height, true, true, 0xffffff, false); (using the throwplugin etc) Basically my problem is it all works fine on a pc or mac but when exporting to the phone the loadermax crop appears to work until you finish scrolling and i disable blitmask (to make the links to the recipes clickable again) and it seems to disable all the cropped images and show them in full again, then when scrolling again it enables blitmask and it all looks perfect again then when u stop boom all the images are back full again. Anyone encounters any bugs like this before when using loadermax and blitmask? thanks for any help, not sure what else to post so please ask questions and i'll do my best to answer. chur ed