Quantcast
Channel: Adobe Community : All Content - Edge Animate
Viewing all articles
Browse latest Browse all 9897

Centering Multiple Objects on Stage

$
0
0

Hi all,

 

So I'm trying to create a full webpage, just in Edge Animate.

In this project, I'm having a number of different elements, some are symbols with animations inside, some are pictures, some just shapes and text. I want these seperate elements to all center on the main stage.

I'm using the following code to center an object:

 

sym.$("OBJECT").css({

 

   margin : '0 auto',

 

   position: 'relative'

 

});

 

 

This works beautifully. But when I try to center more objects on stage using the same code over and over again, things go awry. So what I have in compositionReady is:

 

sym.$("OBJECT1").css({

 

   margin : '0 auto',

 

   position: 'relative'

 

});

 

sym.$("OBJECT2").css({

 

   margin : '0 auto',

 

   position: 'relative'

 

});

 

sym.$("OBJECT3").css({

 

   margin : '0 auto',

 

   position: 'relative'

 

});

 

etc...

When I keep repeating the code, each time changing the Object name, the first Object centers but the rest doesn't.

 

So far I did this work-around where I make 'empty' symbols - one symbol for each object I want centered. I make this symbol 100% width and then place the object inside it, using the same code written above in the creationComplete section.

 

I'm simply wondering if there's a better way to do this, i.e. slightly better practice.

 

Thanks in advance!


Viewing all articles
Browse latest Browse all 9897

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>