Current position variable?

If I have several items that move across the screen but the user can click any of them at any time, how do I record the current position of any of the items item in order to use that data to change the position of the item after the user clicks?
This is what I am doing: I have 11 images that slide accross the screen. The user can click any of them at any time. When he clicks one I am scaling the image so it looks like it is comming forward (z axis) and then the rest of the images are scaled down so it looks like they are going back on z axis. So what I am trying to do is get the current position of the image when the user clicks the image so that I can use that to correctly estimate the scaling and moving of the image to make it look like it scales from the center and not from the top left corner.
So if have a variable that gets the current position of the image being clicked I'm thinking I can change its position using something like: x = currentposition + -45;
Thanks for any input!

thanks : )
I see what you mean, I do need to add more data so you see what I'm working with!
I have 11 images loaded and put through an array and then assigned to buttons: b1, b2, b3 etc which are sprites.I then placed them across the stage evenly (they are not all on the stage at the same time. They slide on from the right and go off to the left till the 6th btn is in the middle of the screen. there are about 3 images on the screen at one time). Each one of the images is a btn which will lead to its respective part of the flash project. Each of the buttons are in one movieclip called imageLoaderHost.
I have backbtn and nextbtn which moves the images right or left. I think that should give you a good amount of data as a base to understand what I am doing with the following code now:
          public function setBtns():void {
               btnNext.dir = -1;
               //btnNext.limit=stage.stageWidth-imageLoaderHost.width;
               btnNext.addEventListener(MouseEvent.CLICK, shiftF);
               btnBack.dir = 1;
               btnBack.addEventListener(MouseEvent.CLICK, shiftF);
          function shiftF(e:MouseEvent):void {
               //trace(shiftamount);
               var mc:MovieClip = MovieClip(e.currentTarget);
               var destX:Number = imageLoaderHost.x+ mc.dir * shiftamount;
               trace (destX<stage.stageWidth-imageLoaderHost.width, destX<0);
               //TweenLite.to(imageLoaderHost, 4, {x: destX, ease:Quad.easeOut});
               if (destX>0) {
                    //trace ("if executing");
                    TweenMax.to(imageLoaderHost, 1.3, {x: 25, ease:Quad.easeOut});
               }else if(destX<stage.stageWidth-imageLoaderHost.width) {
                    //trace ("else if executing");
                    TweenMax.to(imageLoaderHost, 1.3, {x: stage.stageWidth-imageLoaderHost.width, ease:Quad.easeOut});
               }else{
                    trace ("last else executing");
                    TweenMax.to(imageLoaderHost, 2, {x: destX, ease:Quad.easeOut});
          public function onButtonClick(e:Event):void {
               var namesArray:Array = ["b1","b2","b3","b4","b5","b6","b7","b8","b9","b10","b11"];
               var buttonWanted:String = namesArray[Number(e.currentTarget.name)];
               switch (buttonWanted) {
                    case "b1" :
                         break;
                    case "b2" :
                         break;
                    case //ETC ALL THE WAY TO B11
So, that all works fine and dandy! So now I am trying to make it so I can pull the x of any of the buttons at any time (or at least 1 of the the 3 that are one the stage at that time) and assign it as a sort of x value so that I can use that to scale it so it looks correct. I will have to scale it and move it at the same time so it looks like it is being scaled from the center because I have the reg point set to the default left top corner and that is what all of my current code is written around.
Hopefully that was not toooooo long winded and my words are somewhat understandable!

Similar Messages

  • Utilizing the cursor's current position in an action?

    I had hoped this would be an easy thing to achieve but I have yet to find a solution after searching for many hours. Basically I want to use the current position of the cursor as a variable in an action, rather than the exact XY coordinates as recorded during the making of the action. More specifically I want to bucket fill a particular part of the image based on where my mouse is at the time of executing the action.
    Any ideas? And with something this simple, would I even need to use a script? Any kind of help would be greatly appreciated!

    Hello there,
    I'm also facing the same problem...
    Have you found any solution or work-around yet?
    The code i'm using is the following:
    IS
    CURSOR cur_autonum
    IS
    SELECT an_nr + 1
    FROM autonum
    WHERE an_kode ='ADV'
    FOR UPDATE OF an_nr NOWAIT
    RECORD_NOT_FOUND EXCEPTION;
    RECORD_IS_LOCKED EXCEPTION;
    PRAGMA EXCEPTION_INIT(RECORD_IS_LOCKED,-54);
    BEGIN
    OPEN cur_autonum;
    FETCH cur_autonum INTO :ptperson.pe_nr;
    IF cur_autonum%FOUND
    THEN
    UPDATE autonum
    SET an_nr = :ptperson.pe_nr
    WHERE CURRENT OF cur_autonum;
    CLOSE cur_autonum;
    ELSE
         CLOSE cur_autonum;
         RAISE RECORD_NOT_FOUND;
    END IF;
    EXCEPTION
    WHEN RECORD_NOT_FOUND
    THEN
    :global.rc := fnc_alert(118);
    clear_record;
    previous_record;
    RAISE Form_Trigger_Failure;
    WHEN RECORD_IS_LOCKED
    THEN
    IF cur_autonum%ISOPEN
    THEN
    CLOSE cur_autonum;     
    END IF;
    :global.rc := fnc_alert(119);
    clear_record;
    previous_record;
    RAISE Form_Trigger_Failure;
    WHEN OTHERS
    THEN
    IF cur_autonum%ISOPEN
    THEN
    CLOSE cur_autonum;     
    END IF;
    RAISE;
    END;
    greetings,
    Emiel

  • Stepper motor 8SMC1-USBhF and power meter PM100D: how to merge the two VIs into one and make a XY graph of the current position and the power

    Hi there,
    I have a stepper motor (8SMC1-USBhF) and a power meter (PM100D). I want to measure the power while the stepper motor is moving, and obtain an XY graph with the current position on x axis and the power on y axis. So I just merged the two VIs together by copying and pasting, and created local variables for current position and readout value, and changed them to read, and then linked them to the XY graph, but apparently it doesnt work.
    So could you please instruct me how to merge them and obtain an XY graph appropriately?
    Attached are the two VIs.
    Thank you!
    Attachments:
    PM100D Simple Example.vi ‏42 KB
    StepperMotor.vi ‏97 KB

    Hello,
    The XY graph requires that each datapoint on the X axis corresponds to a datapoint on the Y axis.  To create XY data you will need to creat two arrays of X data and Y data with the same amount of elements then cluster the two arrays together to wire into the XY graph.  As an example take a look at the VI snippet below.  Is there a specific error being thrown?
    Regards,
    Isaac S.
    Applications Engineer
    National Instruments

  • Create current date variable at universe level

       Hi Everyone
    I have created report regarding to daily car sales. However there is records registered for further months, 2015 December for instance.
    Actually they are error records, but I can't delete them since data transfer is realizing automatically and updates hourly.
    That is why I have decided to use prompt for report: date is less or equal to current date. But couldn't find way how to create current date variable.
    Please help with this.
    Regards...

    Yes.
    Create an object called Today as:
    cast(convert(char(10),getdate(),23) as datetime)
    Note that it will not parse because it does not reference a table. Don't associate it with a table just to get it parsing as you will then have that table in every query that uses the Today object, whether you want it or not!
    It will work fine when you use it in your query. In your example, create a condition of Ship Date Less Than Or Equal To Today where Ship Date and Today are the names of the two objects. This will then translate into SQL as:
    WHERE orders.ship_date <= cast(convert(char(10),getdate(),23) as datetime)
    This will parse because the table orders is in the statement.
    I hope that is clear.
    Regards,
    Mark

  • Current position in ovi maps 3.06

    Hi All,
    I have N8 with ovi maps 3.06.
    I was just wondering how to get current position in current maps, as there is no option as there was in older versions.
    I click on maps and then nothing happens
    Plese help
    Thanks

    Once you get the GPS Lock (The Red Dot stops flashing..) and start Navigation.. you will see your Location ( a small arrow ) on the map moving as you travel..
    --------------------------------------------------​​-------------------------------------------------​-------​------------------------------------------​--------​--If you find this helpful, pl. hit the White Star in Green Box...

  • How to make BOX position variable in SAPscript

    Can we make box position variable in sapscript?
    Can we pass variable in Box command in sapscript like
    BOX XPOS <v1> YPOS <v2> WIDTH <v3> HEIGHT <v4>.

    Hi,
    Yes we can pass variables to BOX command...
    But the variables should be of type char
    Patil

  • Queries not working with multiple bind position variables?

    still need help here - can anyone provide any direction?
    (note: this is a follow-up from prior topic, " How to use JDBC Positional Binding Style & ExecuteWithParams?")
    I created two simple view objects off of the same entity
    object to perform this test:
    #1 - ViewObject with one bind position variable - where clause: where id > ?
    #2 - ViewObject with two bind position variables - where clause: where id > ? and id < ?
    I created two separate .jspx pages, view1.jspx (one input field) and view2.jspx (two input fields), for each view object by dragging ExecuteWithParams operation onto the JSF page.
    The .jspx page with one input field works (returns result sets.) The view2.jspx page with two input fields does not work - the query does not return any result sets (no errors produced, it just does not return any rows) - I've tested my query outside of jdeveloper and it works fine. I also tried switching my inputs to make sure I did not have an illogical query (i.e., id >100 and id< 1).
    Is there anything different / extra I need to do to use two bind position variables?
    Everything in this simple test was identical except for using 2 input variables versus 1.
    Technology stack is: jdeveloper 10.1.3, jsf/ADF BC, mySQL 5.01
    Message was edited by:
    javaX

    Using the where clause: "where id > ? and id < ?” for the 2 input variables, I get the same result - no row results returned (though query works outside the browser.)
    Interestingly, I modified the where clause to “where between ? and ?”, and then used values of ‘1’ and ‘100’ to test. Using the BC4J tester, the query gave back a single row with id = 100 (should have brought back 100 rows because there are 100 records with id’s 1-100.) So I got it to return something, but not the right results. This makes me believe that a different query is being sent to MySQL other than what I'm expecting from what is shown in the SQL Statement of the View Object..
    Is there anyway to view what SQL statement is actually being sent to the database using the BC4J tester? Also, could this be an issue related to the mySQL connector drivers and JDeveloper? I’m using mysql-connector-java=3.1.11-bin.jar (10/10/2005)? First though, if I could see what query is actually being sent, this may help me to debug and figure out the problem.

  • Get the current position within the PBEL Prozess

    Hi,
    In the BPELConsole I can see the the flow of every PBEL process
    instance and thus I see the current position within the process.
    How would you get the current position programatically, via SOAP e.g.?
    Kind regards,
    Martin

    Hi,
    there is a JAVA API provided by Oracle
    http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b28986/toc.htm
    If you really need SOAP, you can build your own Java webservices with this API

  • Asking for the current position in SAPScript Form

    Hello,
    is there the possibility to get the current position which is printed at that moment in SAPScript Form? Thanks.
    Regards, Lars.

    Thanks Naimesh Patel  .
    Is there anyway to get the PENDING_LINES  value in the script?
    Because i can't modify the standard print program, i can only edit the Sapscript Form and add in some extra subroutine only.
    tnx.

  • My maps didn't show the right current position

    Is anyone can help me how to fix this?
    I always get lost because the maps didn't show my current position. In fact the maps shows other location..
    Regards,

    This is also happening to me, I have 3 friends at work and their Iphones show the right location anytime. Does anyone know if there's a way to calibrate the GPS? or should I get it replaced?

  • MaxL positional variables when defining a partition

    Is anyone using positional variables ($1, $2, etc) in Maxl with a create replicated partition statement?<BR><BR>I am having trouble getting it to work.<BR><BR>create or replace replicated partition 'Sample'.'Basic'<BR>area '"A.Volume.Pounds",@GENMBRS("Time Periods","Gen4,Time Periods"),@LEVMBRS("Entity","Lev0,Entity"),@LEVMBRS("Brands","Lev0,Brands"),"TOTCUST","$1","$2","$3"' sourcearea1<BR>to 'Sample'.'Test' at 'localhost' as 'user' identified by 'password'<BR>area '"A.Volume.Pounds",@GENMBRS("Time Periods","Gen4,Time Periods"),@LEVMBRS("Entity","Lev0,Entity"),@LEVMBRS("Brands","Lev0,Brands"),"$4","$5","$6"' targetarea1<BR>mapped targetarea1('"TOTCUST"') to ('')<BR>mapped globally ('"$1"') to ('"$4"')<BR>mapped globally ('"$2"') to ('"$5"')<BR>mapped globally ('"$3"') to ('"$6"')<BR>outline direct<BR>update disallow;<BR><BR><BR>When passing the parameters through the command line, actually a bat file, I am doing the following: essmsh D:\\MaxL\Test.mxl actual final FY05 budget working FY05<BR><BR>My error messages are coming back stating WARNING - 1241137 - [Target] - Partition definition is not valid: [Invalid member '$1' in global map].<BR><BR>I figure this is either a syntax issue with quotes or for some reason positional variables do not work when defining partitions.<BR><BR>Any input would be appreciated.<BR><BR>Thanks.<BR>

    I played around with \ but couldn't get it to work. What I've come up with is a bat file that writes a MaxL script and then calls the script it just wrote. During the process of writing the MaxL script I am able to substitute in the input values for the variables. So as far as Essbase is concerned the MaxL script is hard coded with no variables at all. Upon completion, the bat file deletes the MaxL script it wrote to prevent people from opening the file and seeing things like passwords etc. It's extra work and I'm just polishing it off now, but I actually think it's working pretty well.<BR><BR>Thanks for the input.<BR>

  • SmartForms - Window position variable during runtime?

    Hello,
    is it possible to create one window in smartforms and set
    during runtime the position variable?
    Otherwise i have to create around 70 little windows
    The backround is: i create during a loop for each dataset a 2D-Barcodes. In our SAP system we create 2D-Barcodes like that:
    - the Title of a window must start with LS_BARCODE....
    - then in Lasersoft (thats a "printing"-software between SAP and the printer) this software reads this title LS_BARCODE and creates an 2D Barcode with the datas in the textfield below the window.
    best regards,
    jasmin

    Hello Jasmin,
    Perhaps note 359009 will address your problem or provide you with a workaround, using the "late processing" type window.
    Kind Regards,
    Martin

  • Moving to new country, wrong current position on maps

    Hello expert,
    I have been moving from switzerland to brazil a month ago. Everything went fine (thanks for asking), and a week ago I have received some of my furnitures including my airport extreme. I plug my airport extreme on my network, close the wifi from the ISP and use the wifi of my airpot extreme, and since then my current position on maps is incorrect (it is my old address in switzerland).
    I have made a hard reset, change the address links to the mac address of my airport extreme on www.skyhookwireless.com, change the address on my contact. Indeed I have done everything suggested on this thread :
    http://forums.macrumors.com/showthread.php?t=1597209
    Anybody has another suggestion before I definitively  smash my airport extreme ?
    Kind regards,
    Manu

    The issue has come up several times lately.. it will self correct in a few months.. more or less.. it is unknown but the old registration of the unit to its old IP will not be updated in world IP maps for several weeks. Eventually it does..
    Apple provide no help.. and you cannot even move your place of identification to Brazil. This is why automatic systems without manual override is such a pain.. most routers allow you to spoof the MAC address of the WAN. Until apple do that it won't work.
    Buy an airport in Brazil if it bothers you.

  • Widgets? - best option for recruiting company to display various 'current positions vacant'?

    Which is the best widget in MUSE for a recruiting company looking to LIST vacant positions?  So a LIST of all the current positions then when you click on individual position titles, all the text info comes up about the role and perhaps even company logos and other industry images for that role??  Cheers for any help.

    Hi,
    You can use a composition widget for this purpose. And if you want a compact one which can expand when clicked on it, then you can use the accordian widget under panels in the widget library.
    Perhaps, if you could share a screenshot or a link to a website which has such a list , then it would be easy for us to help you with the most suitable widget for this purpose.
    Hope this helps
    Regards,
    Rohit Nair

  • Current position of Cursor in TextEdit Element

    Hi
    I would like to know how can i determine the current position of the cursor in general.
    I would also like to know the current position of the cursor in textedit element.
    Regards
    Piyush

    I checked the property, but it does not fulfill my requirement.
    What i want is:
    There is a view with several textedit/input elements, say A,B,C....n
    There is a Helper Function Button, But.
    Now when the user clicks on the button, i need to add a text, 'HELLO' in the element where the cursor is currently positioned.
    So in other words, the focused element will be appended by text 'HELLO'...
    So if i can find out the focused element, then i can append the text.
    Now my question is how do i find out the focused element in the view.
    Regards
    Piyush

Maybe you are looking for

  • How to fill a transport request from SPRO

    How could I repeat transport of customizing already done and transported. I have feeling something is missing but I do not know exactly what. I know how to enter in a transport request content of tables(also customizing) but I am not sure this is the

  • Display parameter values

    Hi All,    I have a parameter list of values that are ID's. I would like to display on the report header, the list of values selected but show the name associated with the ID. Example: My parameter derives from a table: ID    Name 1   Chocolate 2   S

  • Panning in Flash

    Hi Everybody, I am new to Flash and was trying to create a show like this: http://www.ikies.com/overview.html One half would have a panning image and the other half would be a solid background. I saw the article on panning and it worked: http://lived

  • INI_TRANS for TABLE and INDEX

    Hi, My DB version is 10.2.0.3 As by default the INI_TRANS of tables is 1 and for indexes is 2. For some reasons I have to increase the INI_TRANS of a table to 5, then what value do I set for INI_TRANS of indexes on that table? I have read somewhere t

  • I need A help me

    Hello I hope to be back to activate my account