ActionScript 3.0 :: Resize Object To Hexagon Form (Not Square)
Feb 3, 2009
I developed so far, a function to resize objects (images, shapes) and center them inside a hexagone clip (similar to the bees hexgagon cells).
function imageResizer (b, maxW:Number, maxH:Number) {
var r:Number;
r = b.height / b.width;
if (b.width > maxW) {
b.width = maxW;
b.height = Math.round(b.width * r);
} if (b.height > maxH) {
b.height = maxH;
b.width = Math.round(b.height / r);
}}
Symptoms: The function resizes the object being passed to it, but, there's still some room to fill inside the square, but now it's empty! is there any solution to resize the objects with max width/height and still be able to fill the whole area of the hexagone resizes.
View 4 Replies
Similar Posts:
Dec 2, 2010
when creating a dynamic square with the api. 400 by 400. I am not sure why it wont draw the object
[Code]...
View 2 Replies
Dec 3, 2003
I am messing around to learn more about actionscript and I am trying to have a square movieclip resize itself so both sides are equal to 50 here is my code on the movieclip it does the resize and all but it keeps on going. I am not sure how to stop it.
[Code]....
View 6 Replies
Jun 29, 2006
just wondering how to resize a square so that a thumbnail size image comes through
heres the link peeps: its awesome [URL]
View 1 Replies
Oct 24, 2006
how to resize an item (a vector square or such) on drag? In other words, I want to click a side and drag that side having it resize. Sort of like WACK [URL]
View 1 Replies
Feb 11, 2012
I've been trying to make a small isometric game, based on a grid of hexagons. So far I've managed to draw the hexagons and fill the screen. However, I can't seem to find any tutorials or information on how to convert them to an isometric view. The ones I have seen assume you want to draw squared and boxes. Does anybody have suggestions on how I do this?
View 2 Replies
May 28, 2010
I have a square object in the middle of circle.and i can move square object using up, down, left, riht arrow keys. I need script for when square object touches circle, then it goes to back, I have use for this below code :
var myobjdim:Array=new Array;[code].....
In above code "myobjdim" is square object and "bg1" is circle object..
View 1 Replies
Jan 15, 2010
I have this game, and some levels have a moving square as the player, you move the square with your arrow keys.... I want to have an enemy square that chases the player square.... They only chased mario when you didn't look at them? Kinda like that...... but in this regards:
I only want the enemy square to chase the player square when the player square moves.... soo say the player square moves 5 pixels per movement (know how to do all that), I want the enemy square to move when the player square moves..... towards the player square at like 7 pixels per movement..... so eventually you won't be able to avoid the enemy square....
View 4 Replies
Oct 11, 2011
I would like to change backgroundColor of an drawn object(square) by mouseover. I acutally found the function for mouseover in action scripts but BackgroundColor("#ccc") does not work.
View 3 Replies
Mar 6, 2012
I'm building my website using a flash template i bought. There is some sort of object (it's called sprite 45) that is like a box (I'll call it the Mystery Box). It is overlaid on a text box with my bio in the text box. When I run the test movie for the flash file, the bio comes up very narrow. It's width is constrained by the Mystery Box. It's really narrow, hardly more than an inch, which makes it hard to read the bio. It's possible to scroll the bio up an down, but it's still too narrow. I'd like to widen the Mystery Box. However, unlike the text box, it doesn't seem possible to do it.
View 2 Replies
Nov 16, 2010
I have multiple rectangles, all the same symbol. I want all of them to have the same animation sequence; to zoom in when the user clicks one of them. Using a tween. Now, these rectangles are obviously not in the same position, so if they all have the same animation, the final frame won't be positioned in the middle, but most likely cut off by the screen boundaries. Is there some way in Actionscript to make the last frame of the zoom tween be positioned in the middle of the screen for all the different instances?
View 3 Replies
Aug 9, 2005
I am trying to resize an object inside a movie clip. In inside this movie clip there is two objects. One object is the main one that I want to resize while draging the other. The problem is that when I am calling the drag object it does not respond.
View 1 Replies
Feb 28, 2007
I'm making a resize function that has to resize a Project object that extends Sprite.
But I keep ketting a type coercion error:
TypeError: Error #1034: Type Coercion failed: cannot convert AS:: Project@318ff89 to mx.core.IUIComponent.
I've tried casting the Project object to an UIComponent or DisplayObject, but this also throws a TypeError.
[AS]var resizeTarget:UIComponent = new UIComponent();
resizeTarget = UIComponent(target.getChildAt(0));
var myResize:Resize = new Resize(resizeTarget);[/AS]
So basically should I try avoiding the use of Sprites in Flex?
View 4 Replies
Dec 8, 2010
I am just getting back into using Flash after not using it for about 5 years. I'm having an issue with the simplest thing! I want to be able to type pixel values into the Properties panel to transform/resize an object from the OBJECT CENTER as reference point. If I use the transform tool, it uses the center of the object as the reference. However, if I do as above and type values into the Properties width/height, the object transforms with the top left corner as reference. If I need two or more objects sized exactly the same, or if I want to do a "zoom in" effect, using the transform tool is very ineffecient!
My object seems to be showing that the center is set as the reference point (white circle in center of object). Also, the objects I am working with are jpg's and psd's imported to the library, and made into movie clip symbols.
View 9 Replies
Feb 3, 2010
I am trying to basically migrate this: [URL] to ActionScript 3.0 or some how achieve the same resizing effect.
View 5 Replies
Aug 21, 2003
I need a script which can animate an objects resize through AS. I know that
on (rollOver) {
_root.reBox._width = 100;
} on (rollOut) {
_root.reBox._width = 50;
}
Will jump my MC "reBox" to 100px on rollover and to 50px on Rollout, but how do I get AS to animate the transition - basically a tween!
View 8 Replies
Nov 19, 2010
I want to center a big movieclip (1400 px wide) on my stage on stage resize. This big movieclip moves to the right on certain events so I can't use code like this:
currentPage.x = ((stage.stageWidth/2) - (currentPage.width/2))
Is there a way to maybe use its offset from 0 (the left side of the stage 'viewport') and use that offset in centering? The movieclip only changes in x.
View 2 Replies
Jul 10, 2011
I was wondering how to achieve the native scrollbar effect which TheFWA (thefwa.com) has managed to do pretty well (I am not a fan of Flex scrollbars).and implemented the technique, as I am calling a JS function through ExternalInterface every time, when the flash object changes size. This JS function simply resizes the div which holds the flash object, which creates the native bars.Unfortunately, when I resize quite rapidly (from 800 to 1800 height, for instance) the flash object simply gets warped for several milliseconds (as if it hasn't changed its size, but simply got pulled in all directions). After these milliseconds, things get back to normal, but the whole situation is really visually annoying.
Originally I thought that it's simply a timing issue, but after a bunch of attempts to set a delay, the effect was the same ... just delayed.How can I resolve that? I know it's technically possible. Just take a look at TheFWA, and see how smoothly flash and the browser are communicating with each other to make the native scroll bars work, without any flickering, or mismeasurement
View 3 Replies
May 22, 2009
I'm working on Flex component which can be resized using handles on the right and left (that is, if you click and drag the left side, the component will grow to the left, if you click and drag on the right, it will grow to the right).
Right now I am using:
var oldX:Number = this.x;
this.x = event.stageX + (initial.x - initial.stageX); // Move the left edge to the left
this.width += oldX - this.x; // Increase the width to compensate for the move to the left
But that makes the right side jump around, and generally looks ugly.
What is the "right" to do this? Is there something fundamental I've gotten wrong?
Edit: The jitter occurs on the right side of the component. When I set this.x, the component moves to the left, the screen redraws, then the width is updated, and the screen redraws again.
View 3 Replies
Sep 1, 2010
lets say i have 2 classes in the same package.and i add the same event listener to each of them, for example i add event.resize to some display object container in both of them.how can i prevent the code attached to that listener to execute in one of the classes if that event happens?
View 2 Replies
Feb 23, 2011
Does anybody knows if is possible to detect if a stage element touches other one on stage resize?
View 1 Replies
Oct 2, 2009
How can I create a dynamic object from a string? Here is my current code with incorrect results:
[Code]...
I would like the previous code to output the following:
[Code]...
View 3 Replies
Dec 14, 2011
I have been posting some threads about parts of this problem and finally i am able to make the stars successfully form what i have set-up in their movieClip, but only once.The problem now is that i am trying to make the stars follow this list of actions:Spread the stars initially and then make them form the existing form in the movieClip(works);Change the frame in the movieclip to anoBelow i will have the code explained and show where i think i have my issue:Create the Position x and y arrays and Spread the stars
Code:
var xInitial:Array = new Array();
var yInitial:Array = new Array();
[code]......
View 2 Replies
Aug 18, 2010
Is it possible to enable the user to resize an object in the flash movie?
What I want is a box for example, that can be dragged and dropped but also resized both vertically and horizontally. For example the user is able to drag the bounds of the box in a direction thereby making the box bigger or smaller. The mouse should also change to tell the user that he/she is enabled to do so.
View 1 Replies
Jun 30, 2011
i wan to change and resize image object in graphic or button dynamiclly, how?
View 3 Replies
Jul 14, 2009
How to resize a BitmapData ?I've got this right after loading an image:var bitmapdata1:BitmapData = Bitmap(_bitmaploader.contentLoaderInfo.content).bi tmapData;I want to create a new BitmapData called "temp": var temp:BitmapData = new BitmapData(_custom_resize_width, _custom_resize_height);which should become a resized version of the " bitmapdata1 "how do I do that ?my attempt worked but produced white background:
var mat:Matrix = new Matrix();
mat.scale(_custom_resize_width / bitmapdata1.width, _custom_resize_height / bitmapdata1.height);
[code].....
View 4 Replies
Sep 19, 2011
I am working on image and i like to scale or resize the image by dragging and resize option.same working as "free transform tool" in flash (design part); i need same functionality in application.
View 7 Replies
Jul 7, 2011
I'm having a bit of a problem here. As per the title, my flash swf file works fine when tested from the IDE, but when I publish it and open it through the browser, the stage doesn't seem to resize along with the window.I post below a bare-bones example. The "back" movie clip should resize, only it remains at the starting dimensions
Code:
import flash.events.Event;
import flash.display.MovieClip;
[code].....
View 9 Replies
Feb 4, 2009
I am having some issues with a php email form that I am using in my AS3 project. the form works perfect and all communication is good.however when the user is on the page and wants to tab to the next text field it jumps to one of my hyperlinks on the same page and not to the next text field down on the php form.
is there any way to stop this from happening.I have tried placing the php form on a seperate layer in a seperate mc and I have done the same with the hyperlinks .you can see what I mean by visiting this development site.(after entering go to contact)http:[url].....
View 2 Replies
Jul 17, 2010
I have only two fields Name and Email in a Order form and a PayPal button for payment at PayPal ( into my account).I can do the mail portion but have no idea about PayPal code, however on search here I found one code and after pasting this one to the PayPal button it redirects to my PayPal account.But the question is anybody can post a message and leave the site without paying me. How can I do this thing so that the user will forced to pay before posting the mail form.
View 1 Replies