How do I move a symbol from code?

I'm actually trying to centre and scale a symbol, while maintaining aspect ratio, such that the width fills the stage, but that only seems to be possible for background images (width:100%, height:auto).
I created a symbol (with about 6 divs (rectangles and text) in it) on the stage and names it 'content'. The stage is 100% wide and 100% high. On window.resize, I set content scale thus -
var stageWidth = $(window).width();
var contentWidth = sym.getSymbol("content").getSymbolElement().width();
var m = stageWidth / contentWidth;
sym.getSymbol("content").getSymbolElement().css("-webkit-transform", "scale(" + m + ", " + m + ")");
It scales fine, but it scales about a weird point making the symbol appear to move as the window resizes. I want it to remain at the left hand side (filling the viewport). I couldn't work out how to make it do that in the interface, so I started to attack it with code
console.log("before: " + sym.getSymbol("content").getSymbolElement().position().left);
sym.getSymbol("content").getSymbolElement().css("position", "relative");
sym.getSymbol("content").getSymbolElement().css("top", "0px");//actually needs to be -(half of (content height - stage height))
sym.getSymbol("content").getSymbolElement().css("left", "0px");
console.log("after: " + sym.getSymbol("content").getSymbolElement().position().left);
But that isn't having any effect at all (other than filling my javascript console). How can I move this thing to the correct position?

Thanks Tim, but changing the width and the height of my_symbol just doesn't reproduce what I'm trying to acheive, or the problems I'm having as a result of that. I need to scale the symbol, not resize it.
I just tried you code anyway. my_symbol does stay top left, but actually it stays left if I use your code without the bottom two lines. You need
sym.getSymbol("content").getSymbolElement().css("-webkit-transform", "scale(" + m + ", " + m + ")");
to cause the wierd positioning issue.
Here's a result you might find interesting. I tried this code -
var stageWidth = $(window).width();
var contentWidth = sym.getSymbol("content").getSymbolElement().width();
var m = stageWidth / contentWidth;
sym.getSymbol("content").getSymbolElement().css("-webkit-transform", "scale(" + m + ", " + m + ")");
sym.$("content").css('left', 0);
sym.$("content").css('top', 0);
console.log("left: " + sym.getSymbol("content").getSymbolElement().position().left);
Then I resized the browser a bit and got this trace
left: 45
left: 45
left: 37
left: 37
left: 27
left: 27
left: 20
left: 20
left: 8
left: 8
left: 4
left: 4
left: -2
left: -2
left: -8
left: -8
left: -9
left: -9
So it looks like content's left isn't getting set to 0 at all. Oh dear. -ve numbers are from browser widths greater than 720, which is the width of 'content' before I've filddled with it.
I can't even work which point it's scaling about! If I could make that the middle left then I wouldn't have a problem.

Similar Messages

  • How do I move the pictures from my iPhone 4s to a folder on my computer?

    How do I move the pictures from my iPhone 4s to a folder on my computer?

    you will need to import your pics to your computer http://support.apple.com/kb/HT4083

  • How do I move Contacts & Calendar from one User to another User on the same Macbook Pro?

    How do I move Contacts & Calendar from one User to another User on the same Macbook Pro? OSX 10.9.5

    is this second library in a different account on the computer?
    Look at Home Sharing.
    iTunes: How to share music and video - http://support.apple.com/kb/HT2688 - about Music Sharing and Home Sharing
    Home Sharing Support page - http://www.apple.com/support/homesharing/
    iTunes: Setting up Home Sharing on your computer - http://support.apple.com/kb/HT4620
    iTunes Home Sharing now works between users on same computer - https://discussions.apple.com/thread/3865597

  • HT4528 how do i move an icon from one screen to another on my Iphone 5?

    How do I mov an icon from one screen to another on my Iphone 5?

    Tap and hold an Icon until they begin to shake. Move the Icon towards the edge of the screen and hold for a couple seconds. The Icon will then "jump" to the next screen.

  • How do I move a contact from one group to another?

    On my device, or in iCloud on the web, how do I move a contact from one group to another.  This should be as easy as it is with calender items, but the only solution I've found is to change your default contact group, and email the contact to yourself.  Then tap the contact, and add it to your contact list.  You can then delete the original.  Is there an easier way???

    Hi rjwrjw11,
    Thanks for visiting Apple Support Communities.
    If you want a song to be listed under a different album in iTunes, you can edit the song information:
    Fixing Incorrect Song or Album Listings in iTunes
    http://support.apple.com/kb/TA24677
    Editing Track Information in iTunes
    To view and edit a song or video's info in iTunes:
    Click once on the track title to select it
    From the File menu, choose Get Info
    Click the Info tab
    Best,
    Jeremy

  • How do I move vznavigator favorites from one phone to another?

    how do I move vznavigator favorites from one phone to another?
    Wife has Pre 2 where GPS works beautiful... my old Pre Plus was always hit or miss on GPS.
    But I've developed quite a library of favorites on my Plus.  How do I move these to our new Pre 2?

    Good afternoon CWFlink.
    I am a fan of the VZ Navigator myself, and all of the great features of this application!  Is the Palm Pre 2 on the same number as the Palm Pre Plus?  If yes, you can synchronize your Favorites through our website at the following link: VZ Navigator  
    You will sign in using your My Verizon login information, and sync the Settings and Favorites to your new device.  However, if your Favorites are on a different mobile number, you will have to manually enter in the information/ settings.  I still encourage you to use the website to set everything up as you like, in case you need to change devices in the future.
    I trust this information is helpful.  
    Thank you,

  • How do i move an app from one page to another

    how do i move an app from one page to another? When I upgraded to the latest software on my 4s, the camera went to the last page rather than remaining on the home page

    What Rudegar says is true, but it's a lot easier to rearrange icons in iTunes:
    Connect your phone and open iTunes. 
    Click on the Apps tab. 
    You will see your home screen in the main window, with the other screens in a scrollable column on the right. Scroll down and click on the last page to put it in main window. 
    Now scroll the column so the home page is visible on the right.
    Click on the Camera and drag it onto the home page at the right. 
    Be careful not to accidentally insert it into another app, thereby creating a group.

  • HT1449 how do you move all music from two computers into one itunes account?

    How do you move all music from two computers into one itunes account?

    An "iTunes account" is an online account you use for buying music, like a bank account.  An iTunes collection is the media you see when you open iTunes. Which do you mean?
    If it is two computers, it would also help to know where these are located. Are they on the same local network? If they are, try Home Sharing (and you have control of both and you aren't just trying to get music fro your computer to your friend's computer in another state).  If they are not, you'll have to use an external hard drive or flash drive.
    Is this on a PC? Your computer information says Windows but you posted this in the iTunes for Mac forum.

  • How can I move purchased apps from one itunes account to another account?

    How can I move purchased apps from one itunes account to another account?

    You can't. The apps must be purchased separately.

  • HT4059 How can I move a book from one device to another

    How can I move an iBook from one device to another

    Now when I drag and drop the photo no red # shows up and the photo stays in project 1 and also shows up in project 2 apparently creating a duplicate.
    The projects are the basic containers.  Each image and all its versions are in exactly one project.
    You can use an image in many albums, without duplicating it, also in many products like books, screensaver, slideshows.  But the projects are the basic structure of the library and you cannot have the same image in two different project, without duplicating it by storing the same original image files twice. Use albums to organize your library thematically.
    Sorry, I misread your question.   Dragging an image file between projects should move the image and all its versions to the other project.  Aperture should only duplicate the image, if you hold down the alt/options key while dragging and move the image otherwise.
    Which Aperture version are you using? And which MacOS X version?  Is your profile signature "MacBook Pro with Retina display, Mac OS 9.2.x, Aperture 3.5.1" still valid?
    In Aperture 3.6 on MacOS X 10.10.1 dragging between projects is still working as expected:

  • How can I move my project from external hard drive to my macbook pro?

    How can I move my project from external hard drive to my macbook pro? every time I try to do some editing, the sequence is very slow, thanks in advance

    Try here...
    Setting-up a new Mac from an old one, its backups, or a PC

  • How do I move an icon from the second page of my home screen to the first page  and vice versa?

    How do I move an icon from the second page of my home screen to the first page and vice versa?

    Hold an icon down until they all wiggle.
    Drag it wherever you want it.

  • How do i move an app from itunes to my iphone

    how do i move an app from itunes to my iphone?

    Connect the iPhone to your computer, select it under 'Devices' on the left-hand side of your computer's iTunes, and on the right-hand side of iTunes on the Apps tab you should be able to select which apps to sync to the iPhone.

  • How do I move my iTunes from one computer to another?

    How do I move my iTunes from old computer to a mac?

    If the old computer is a mac, then use migration assistan or copy the entire itunes folder.
    Otherwise, type " move itunes library from pc to mac" into the google search bar

  • How can you move the objects from one server to another?

    how can you move the objects from one server to another?

    Hi,
    Collecting objects for Transporting
    1. rsa1->transport connection
    2. left panel choose 'object type', middle panel choose 'infocube' and 'select objects'
    3. then choose your infocube and 'transfer'
    4. will go to right panel, choose collection mode 'manual' and grouping only 'necessary objects'
    5. after objects collection finished, create request
    6. If they are $TMP, then change the package.
    7. When you click the Save on the change package, it will prompt for transport. Here you can provide an existing open transport request number, or if you like here itself you can create a new one.
    8. You can check the request in SE09 to confirm.
    Releasing Transport Request  
    Lets say you are transporting from BWD to BWQ
    Step 1: In BWD go to TCode SE10
    Step 2: Find the request and release it (Truck Icon or option can be found by right click on request #)
    Note: First release the child request and then the parent request
    Steps below are to import transport (generally done by basis )
    Step 1: In BWQ go to Tcode STMS
    Step 2: Click on Import queue button
    Step 3: Double Click on the line which says BWQ (or the system into which transport has to be imported)
    Step 4: Click on refresh button
    Step 5: High light the trasnport request and import it (using the truck icon)
    Transport
    http://help.sap.com/saphelp_nw2004s/helpdata/en/b5/1d733b73a8f706e10000000a11402f/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/0b/5ee7377a98c17fe10000009b38f842/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/media/uuid/224381ad-0701-0010-dcb5-d74236082bff
    Hope this helps.
    thanks,
    JituK

Maybe you are looking for