ActionScript 3.0 :: Make Filters Scale Relatively With Parent DisplayObject?
Nov 28, 2009
S there any way filters applied to a DisplayObject (drop shadow, glow, bevel) can scale relatively with the parent (the DisplayObject it is inside)?And what about other properties like .distance for drop shadow?For example... If I have a 100px rectangle with a 10px glow inside a container object, and I set scaleX/scaleY of the container to .1, I want the glow to inherit the scale change from the parent (1/10th the size) just as the display object does that the filter is applied to.Instead, if you try this, you will see the glow stays at 10px no matter what scale the filter target or the container is transformed by.Pseudocode example (steps to reproduce),
1) create a sprite called _myOuterSprite on stage at scaleX = scaleY = 1
2) create a sprite called _myInnerSprite inside _myOuterSprite at scaleX = scaleY = 1
3) draw 100px rectangle into _myInnerSprite
4) apply 10px glow to _myInnerSprite
5) transform scale of _myOuterSprite to .1
Result:
- child sprite (rectangle) scales to 1/10th the size
- glow stays the same size
How can I make it so that glow scales to 1/10th as well?
...without capturing and scaling bitmap data
...without losing interactivity on objects
...in a way that would work visually for every filter, not just glow (drop shadow has distance property too, etc)
View 7 Replies
Similar Posts:
Nov 28, 2009
(i'm using flashdevelop / flex sdk)IS there any way filters applied to a DisplayObject (drop shadow, glow, bevel) can scale relatively with the parent (the DisplayObject it is inside)?And what about other properties like .distance for drop shadow?
For example... If I have a 100px rectangle with a 10px glow inside a container object, and I set scaleX/scaleY of the container to .1, I want the glow to inherit the scale change from the parent (1/10th the size) just as the display object does that the filter is applied to.Instead, if you try this, you will see the glow stays at 10px no matter what scale the filter target or the container is transformed by.Pseudocode example (steps to reproduce),
1) create a sprite called _myOuterSprite on stage at scaleX = scaleY = 1
2) create a sprite called _myInnerSprite inside _myOuterSprite at scaleX = scaleY = 1
3) draw 100px rectangle into _myInnerSprite
4) apply 10px glow to _myInnerSprite
5) transform scale of _myOuterSprite to .1
Result:
- child sprite (rectangle) scales to 1/10th the size
- glow stays the same size
How can I make it so that glow scales to 1/10th as well?...without capturing and scaling bitmap data ...without losing interactivity on objects...in a way that would work visually for every filter, not just glow (drop shadow has distance property too, etc)
View 4 Replies
Jul 16, 2009
I animate a DisplayObject with a Motion XML (exported from Flash). The first time I apply a motion to it, everything works fine. The second time I apply a motion, the position / scale is reset to what it was before I first applied a motion. How can I keep the transform of the DisplayObject after a motion is played when I want to play a new motion ? I want the DisplayObject to start from where it was at the end of the first motion.Here's the code I use:
private function animate(motionXML:XML, target:DisplayObject):void
if(!animator)animator = new Animator(motionXML, target);
// Add event listerners
[code].......
View 5 Replies
Nov 5, 2010
I've been banging my head trying to figure out how to get this to work with no success... I have a class that extends MovieClip which loads a large image into it. This image has a mask applied to it to only display a specific section of the image. I need to be able to scale this MovieClip based on it's visible width & height while maintaining it's proportions.
I'm currently using Collin Moocks' approach (see it here:[URL]) to get the visible width and height of the movieclip, but I can't figure out how to get it to scale correctly based on those dimensions... Preferably I'd like to be able to set it's visible scaleX & scaleY properties similar to how you currently set the scaleX & scaleY, (i.e. movieclip.visibleScaleX = 1.5).
View 2 Replies
Feb 25, 2009
Firstly, I've created a global variable called mc to store a movieclip instance:[code]Later on inside a function, I've created a new instance of my movieclip and added it to the stage.[code]Now, this is working fine most of the time. But at one particular point in my program, after many other things have happened, when trying to remove this movieclip it throws the 'display object must be a child of the caller' error.So, I'm thinking if mc isn't a child of the stage, what is it a child of? Tracing mc.parent returns null - so it seems to be telling me that the parent (which was definitely the stage when it was created) has wandered of somewhere and abandoned my movieclip!I have no idea how this has happened, and as the whole program is several thousand lines long I can't post it here. So, does anyone have any idea what might cause a display object which is added to the stage to become orphaned like this?
View 1 Replies
Oct 5, 2010
How can I check what the parent of a displayObject is? What is the parent of myObject for example.
View 1 Replies
Feb 25, 2008
i was caught in the situation that i need the DisplayObject to access its parent.variable.
I have a Loader"B" was inside MovieClip"A"(with a variable"v") and i want called A.v like this:
Code:
trace(B.parent.v);
the above code is not working. and I need something similar. is it possible??
by the way, it has to be dynamic because i need to use it with function:
Code:
function doSomething (d:DisplayObject):void
{
trace(d.parent.v);
[Code].....
View 4 Replies
Dec 16, 2009
MovieClip add itself to a chosen parent DisplayObject in its Constructor Method?
View 5 Replies
Oct 18, 2009
In flash if I change scale of parent movieclip, scale of all child inside the parent was changed too. Now I look for the best way to fix child scale while parent scale is changing. I mean the way with minimum listener and cpu usage. In my project I have a map (as parent) and many icons on map (as childs). map has zoom in and zoom out button and pan while dragging.
View 2 Replies
Jun 7, 2005
I'm creating a simple navigation for a portfolio site. On my main (root stage) I have one movie clip. Inside this movie clip I have all the elements of my website. I'm doing this so the user can scale and move the navigational elements around. This is accomplished by simply placing actionscript on frame 1 on the main (root stage).
Code:
nav._xscale = 60;
nav._yxcale = 60;
Eventually I will but a slider on the main stage so the user can scale to whatever size. My problem is that everything scales fine, however, the hitboxes become extremely small, and don't scale with the rest of the elements.
Code:
onClipEvent (load) {
this._x = 8;
this._y = 25;
speed = 2;
} onClipEvent (enterFrame) {
[Code] .....
View 1 Replies
Nov 29, 2009
I've got a MovieClip containing several child clips (images and text). I'm trying to scale this parent clip very slowly - from 102% down to 98% - this works, however the child movie clips are all scaling a bit jerkily - like they're trying to stick to pixels or something. What's the cure for this? The scaling is done by using a motion tween on the timeline by the way. I've tried to tick "Cache Bitmap" but that makes no difference. If I used the 3D motion tween, there is no jerkyness. But I need to publish to flash 9, so can't use that!
View 1 Replies
Apr 20, 2011
How can I make a DisplayObject popup like Flex PopUpManager in AS3?
View 1 Replies
Jul 8, 2010
I am going to have a situation where i have all sorts of different sizes of graphical data coming at me from XML. The only thing that all of these assets have in common is that they will be sharing a 100px by 100px thumbnail and they are SWFs.My question is, how can i make an object fit into the thumbnail so that:1) Theres no cropping of the item2) Items smaller than 100x100 must be enlarged3) Items larger than 100x100 must be shrunk
View 7 Replies
Oct 26, 2010
I would like to be able to quickly check if a given DisplayObject is a descendant (not in the inheritance sense - ie. child, grandchild, great-grandchild, great-great-grandchild, etc.) of another DisplayObject. There doesn't seem to be a native way to do this and I can only think of two ways to achieve it: Create the mother of all nested loops. Seems a bit, I dunno, wrong? Dispatch a bubbling event at the 'child' and check if the potential 'parent' receives it.
[Code]...
View 2 Replies
Jan 9, 2005
I did a life scale but when I touch the enemy I want it to lower the "canz" variable just one timenut it lowers as it touch this is not what
View 3 Replies
Jun 14, 2009
i want to make a bar jump smoothly from one scale to another, basically like a visual sound output without the sound. I've been stuck on this one for a few hours now and i know it must be just a logic problem
[Code].....
Whats happening here is that the Bar is scaling to the first random point perfectly but as soon as its target becomes a number around 0.50ish it will stick around that forever because the difference will be too small from there to the next point (i think). So is there any way that it can still make large jumps while using Zeno's Paradox type easing?
View 1 Replies
Jul 25, 2009
I'm looking for a way to have the movie play at set dimensions, if the screen is big enough to play it, and scale down if the screen is smaller or the browser is resized. An example of this is here [url]...
As you can see, it's not full screen but set width and height, but when the browser is shrunk it scales it's content to fit within the browser.
View 7 Replies
Mar 19, 2010
I'm trying to resize each image without success. After pulling my hair a few time, I can't figure out to make the smoothing works on Stage. Basically I want to be able to resize any pics: 600x900 -> 400x600
Code: Select all // Call LoadBitmap class, bitmapWidth & bitmapHeight are the desired 400x600
loadBitmap = new LoadBitmap(bitmapWidth, bitmapHeight);
loadBitmap.loadBitmapData(theImage);
[code]....
View 2 Replies
Jan 17, 2007
how to make a graphic scale from 0 - 150% and then back to 100% using actionscript. I am learning actionscript and I would really like to start to learn how to get away from standard tweening and move into scripting it. There is an example of the movements I am looking to accomplish here :: This is part of the mctween examples - but this is accomplished with a rollover/out. I am just interested in getting this effect but just a straight animation when the playhead stops on the frame.
[URL]
View 2 Replies
Feb 5, 2010
[code]All clips are squared.Ok, on the PlayerPlane, there are little soldiers, which have hotkeys. The effect I'm trying to create is I want to position the GameStage so that the currently selected soldier appears in the center of the GameClicker clip.The GameStage is movable by the player (to scan other areas of the map)by holding the CTRL key, so it's easy to kinda lose track of where your players are.I have tried using localTo Global and globalToLocal techniques, but I think I'm lost on the actual math of getting the GameStage to move the correct distance so that the selected soldier is centered to the GameClicker.[code]
View 2 Replies
Jul 20, 2011
I am using Flash Builder 4.5 to build an iPhone app.In order to display ads I plan to use StageWebView and load a webpage containing the ad code.Lets say the ad will be 320x50 pixels.So the Actionscript code would look similar to this:
adView = new StageWebView();
adView.loadURL("http://www.myadishere.com/ad.html");
var top:Number = navigator.actionBar.measuredHeight + 1[code]....
In the application I have set the applicationDPI="160" so the application is displayed properly when run on iPhone3 and iPhone4.However the content of the StageWebView looks tiny on iPhone4.If I do adView.drawViewPortToBitmapData() the bitmap's size is OK.how to make the StageWebView content to scale accordingly, so it looks OK regardless of the screen DPI?
View 4 Replies
Oct 31, 2011
I have a 3D image gallery I am working on and would like it to fade and scale onto the stage (whilst still spinning)Make image gallery fade and scale in?Here is the link to my test page.
I have also attached the current actionscript code in a zip file.[url]...
View 0 Replies
Jun 20, 2009
My website is going to have a main wrapper that is set to a max-width property for compatible browsers. It will stretch to 940px across at max. When scaled down I would like the swf to scale proportionately with it. Like an image with width percent applied. The flash movie has the dimensions of 940 Ă— 360 pixels.
I can't seem to figure out the correct attributes to add to the embed tag to get it to do this.I am currently using jquery flash embed, but am open to other options, though this is my ideal.In the example I have set the flash background to black.
When resize the browser window the flash movie doesn't scale proportionately to the div, only the photo does, leaving a blank canvas (black), while the div height stays the same. I can't add a height value in the CSS.How do I make this scale correctly? Adding a noscale param only crops the image. The swf's height doesn't scale also.
View 3 Replies
Nov 3, 2010
I have the following markup:
<s:Group width="100%" height="100%">
<s:BorderContainer borderWeight="3" borderColor="black" cornerRadius="5" width="100%" height="100%">
[code]....
View 3 Replies
Dec 15, 2010
Okay so I need to make a basic activity (working Flash/as3) that simulates very basic weighing scales. All the objects that go on to the scales are the same weight.
If you imagine the classic weighing scales [URL]..we are dragging/dropping stuff on to the sides and animating accordingly.
I don't want anything fancy, just the maths required to affect the scales according to how many objects are on each side.
What I'm looking for is probably the angle of rotation of the horizontal arm. Any pointers?
View 3 Replies
Jan 20, 2009
When you drag the screen in any direction the background scales and rezises.But How do I make the text stay center and a certain size so that it wont scale to fit the screen and will stay a certain size
View 1 Replies
Nov 8, 2003
I want to make a MC scale when my crsor is over it and go back to normal when it's not.
onClipEvent (enterFrame) {
if (_xscale<100 ) {_xscale = _yscale += 10;
}
}
This is all the as i have but i do not know how to make it so the mouseover function is involved.
View 14 Replies
Apr 11, 2012
I'm having an issue when it comes to line thickness on movie clips, when a movieclip is flipped the line thickness vanishes due to Flash thinking I'm squishing the MovieClip. Is there any way I can make Flash not bother the line thickness when changing scale or some sort of alternative? Or is my only choice to kill line thickness altogether.
View 1 Replies
Mar 20, 2011
I am making my first flash game, and I have very little experience. How would I make a parent of MovieClips, so I can hide all of them onLoad at once, without having to do every single one?
View 6 Replies
Jan 3, 2010
I got a "preloader" that creates an movieclip and loads an SWF. Now in the loaded SWF i want a close button to go back to the "preloader". The preloader isn't an actuall preloader but some sort of mainclip.Now i tried this:removeChild(MovieClip(e.currentTarget).parent.pare nt.parent)But i get error:ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.at flash.display::DisplayObjectContainer/removeChild()at MethodInfo-6()
View 1 Replies