Copy link to clipboard
Copied
Hi all,
I am asking this because I would like to know if this is technically possible in Captivate 9...
What I would like to do is to have a button with a script on it so that when you click it an object
on the screen (this could be an image or a flash SWF object etc) moves from one point of the
screen to another. For example, it could be in the top-left hand corner and when you click the button,
it moves to the bottom right hand corner.
I know you can make one object on one part of the screen invisible by hiding it and making an identical
object elsewhere visible by showing it to give the illusion that it has just "moved" but I am wondering if
a script is possible where I can just move the same object.
Thanks in advance.
Keith
Moderator: took out your personal email address, this is a public forum
Copy link to clipboard
Copied
Most of the time if you just use the element name (e.g "Image_1") it won't work the way you want it to, your best option is to check the object name within cp-frameset if you inspect on a browser while previewing it. Basically by adding the prefix "re-" and suffix "c" in your script, it works every time for me.
As an example:
document.getElementById("Image_1")
would become:
document.getElementById("re-Image_1c")
Copy link to clipboard
Copied
TQ Very much...at last..itss work
Copy link to clipboard
Copied
Hi Hashim, have you got a working sample of this? I´m struggling to move buttons around when a button is clicked but it doesn´t work at least in html5 preview mode with or without "re" and "c" (why is captivate so awfully undocumented?). I think I´m missing some javascript syntax like add "cp." somewhere. Thanks!
Copy link to clipboard
Copied
Well, I get it to work in a blank project adding the "c" suffix.
var obj = document.getElementById( 'objetoc' );
var posX = parseInt( obj.style.left );
var posY = parseInt( obj.style.top );
obj.style.left = ( posX + 10 ) + 'px';
obj.style.top = ( posY + 10 ) + 'px';
But I have no luck with the button, It seems that the object isn´t really an object and javascript just move the picture of it, not the click box (and the rollover and down states).
Copy link to clipboard
Copied
I kept doing some tests and the winner is... THE CLICKBOX!!
Is the only clickable object I can move properly. The button and the smart shape button lost their action area, but the clicbox moves arround keeping its functionallity. The trick is that you must move simultaneously the object itself and the "re-objectc" thing.
Hope it will be useful for someone.
var obj3 = document.getElementById( 'cajaclic' );
var posX = parseInt( obj3.style.left );
var posY = parseInt( obj3.style.top );
obj3.style.left = ( posX + 10 ) + 'px';
obj3.style.top = ( posY + 10 ) + 'px';
var obj4 = document.getElementById( 're-cajaclicc' );
var posX = parseInt( obj4.style.left );
var posY = parseInt( obj4.style.top );
obj4.style.left = ( posX + 10 ) + 'px';
obj4.style.top = ( posY + 10 ) + 'px';
Copy link to clipboard
Copied
Bad thing is that the click box can NOT be used in Fluid Boxes projects.