Hi all,
Please follow this link for reference: http://www.tiagocabaco.com/other/im2_type_wip/
As you can see I have all those circles scattered around the stage. What I’m looking to achieve now is—keeping that same disposition, “grid” and arrangement I want them to tighten or loosen up when the stage resize listener is called. I know how to do this for all the other elements but here I’m playing with a bunch of different circles that follow a certain gridded pattern and I want to keep that. Any ideas?
Here’s the code I’m using to create, place and arrange the circles on the stage. I think it might help…or not…
private function onAdded( e:Event ):void
{
spaceX = stage.stageWidth / (circle_p_line + 1);
spaceY = stage.stageHeight / ( Math.ceil( ( total_glyphs.length / circle_p_line ) ) + 1 );
for (var g=0; g < total_glyphs.length; g++)
{
var range:int = 50;
var randomDisplacement:Number = Math.round( Math.random() * range ) - ( range / 2 );
var rangeScale:Number = Math.random() * (0.7 - 1) + 1;
array_glyphs[g] = total_glyphs.charAt(g);
var letterToCircle:String = total_glyphs.charAt(g);
if ( total_glyphs.charAt(g) == " " )
{
circle = new DrawCircle( 3, 0xFFFFFF, letterToCircle );
addChild(circle);
circle.alpha = 0;
}
else
{
circle = new DrawCircle( 3, 0xFFFFFF, letterToCircle );
addChild(circle);
circle._circle.scaleX = circle._circle.scaleY = rangeScale;
}
if ( ( total_glyphs.length - (g+1) ) >= circle_p_line )
{
if ( g / circle_p_line == Math.round( g / circle_p_line ) )
{
posx = spaceX;
posy += spaceY;
circle.x = posx + randomDisplacement;
circle.y = posy + randomDisplacement;
}
else
{
posx += spaceX;
circle.x = posx + randomDisplacement;
circle.y = posy + randomDisplacement;
}
}
else
{
if ( g / circle_p_line == Math.round( g / circle_p_line ) )
{
var leftover:int = total_glyphs.length - g;
var startat:int = Math.round(circle_p_line / leftover);
posx = (spaceX * startat) + spaceX;
posy += spaceY;
circle.x = posx + randomDisplacement;
circle.y = posy + randomDisplacement;
}
else
{
posx += spaceX;
circle.x = posx + randomDisplacement;
circle.y = posy + randomDisplacement;
}
}
array_circles.push(circle);
jitter = new JitterCircle( circle, 5 );
jitter_array.push( jitter );
circle.hitarea.addEventListener( MouseEvent.ROLL_OVER, over_circle );
circle.hitarea.addEventListener( MouseEvent.ROLL_OUT, out_circle );
}
tib_mc.submit_btn.addEventListener( MouseEvent.CLICK, onSubmit );
stage.addEventListener( KeyboardEvent.KEY_DOWN, onKeyEnterDown );
}
Thanks in advance!