I'm creating an application that loads the newest videos from a specified YouTube channel. It grabs the title, description, comments, views, thumbs up/down, and a URL to the thumbnail. It loads everything about 12 times and all of this data is stored in an array according to what it is (ex: videoThumb string goes into the array videoThumbArray). What I'm doing now is loading the thumbnail URL and adding it to the stage. I want the thumbnail to have rounded edges, so I create a mask using the Shape class built into Flash.
Here is my code for that specific function:
ActionScript Code: var thumbLoader:Loader = new Loader();thumbLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded);thumbLoader.load(new URLRequest(videoThumbArray[currentThumb])); function thumbLoaded(e:Event):void { var bubbleMask:Shape = new Shape(); bubbleMask.graphics.beginFill(0x006600, 1); bubbleMask.graphics.drawRoundRect((91 - (104/2)), (20 + (160 * (currentThumb + 1)) - (104/2) - 4.3), 104, 104, 17, 17); bubbleMask.graphics.endFill(); bubbleArray[currentThumb].addChild(bubbleMask); thumbLoader.width = 104; thumbLoader.height = 104; thumbLoader.x = 91 - (thumbLoader.width / 2); thumbLoader.y = (20 + (160 * (currentThumb + 1))) - (thumbLoader.height / 2) - 4.3; thumbLoader.mask = bubbleArray[currentThumb].bubbleMask; bubbleArray[currentThumb].addChild(thumbLoader); }
It creates the mask and it loads the image, but it doesn't appear to apply the mask to the thumbnail. I can't tell what I'm doing wrong.
Any help is appreciated!
Thanks,
Jacob
Dynamic Mask
Tuesday, May 29, 2012
[Action Script] Dynamic Mask May,2012
Posted by Bimo Hery Prabowo at 3:13 PM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment