javascript from within actionscript 2.0

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
danwguy
Forum Contributor
Posts: 256
Joined: Wed Nov 17, 2010 1:09 pm
Location: San Diego, CA

javascript from within actionscript 2.0

Post by danwguy »

Ok so I have a flash animation that I programmed in well... flash cs5... and on the button i have "on(release) { getURL("javascript:moveDown();"); menuanim.gotoAndPlay(2); }" and on the button to make the menu go back up its "on(release) { getURL("javascript:moveUp();"); menuanim.gotoAndPlay(31); }" all that works, the menu animation goes up and down and it calls to those javascript functions but when I try to animate the move down and move up functions with...
"function moveUp() {
$("#moveme").animate({
"margin-top": "+=-250px"
}, "slow" );
};" and
"function moveDown() {
$("#moveme").animate({
"margin-top": "+=-325px"
}, 1000 );
};"
respectively it doesn't do anything. The backstory is this. There is a header on the top of the page with a menu button (all built in flash) when you click the menu button the header expands down to show the menu, when it expands down I want the <div>(with the id="moveme") to move down at close to the same rate. I can use other js codes to just move the <div> down but it looks terrible, so I added that little tid bit to animate the movement of the div, only it does nothing now. I have <script src="http://code.jquery.com/jquery-1.4.4.js"></script> in the header of my html and the above mentioned function is in the body contained in <script> tags. I have tried many different syntax's of the same command to no avail, i.e. instead of saying "margin-top": "+=-325px" I used marginTop: "-325px" and still it does nothing. Can someone please help me out with this, it's driving me nuts and I really don't want to have to put this out with the <div> below it jumping up and down, it looks terrible. If you want I can post the code that I used to make the div move without the animation. Also I am sorry for not putting the above code in the code tags, but I didn't see one for js only for php. Please help I am so lost and frustrated with this. Thank you all in advance.
Post Reply