js - keep interaction in divs
- Started
- Last post
- 8 Responses
- wwfc
I got a question for any of you javascript experts on here, it is something that in theory sounds simple enough but is not proving to be any like simple!
I have some javascript in a html page that allows the user to drag divs around the page, this all works fine and the divs swap depths, and drag around lovely - this is the js for this:
http://pastebin.com/m35bcc77dbut the thing that the js in that link doesn't allow for is recognising the actionscript in any swf's that are in the page - I can drag the swf's but not click and play anything within the swf - it recognises a rollover but not any click etc...
So I don't know if I need to be looking at the main js or the actual div itself - here is an example of the div:
http://pastebin.com/m2ce027ffAnyone know how I can combine the drag whilst retaining the AS functionality?
Be really grateful for any help anyone can give...
...pleeease!
- neverblink0
do you have a testpage online? Is it just that you need to ad focus to the swf on drop?
- wwfc0
....yes, focus to the swf - but not just on drop - I need any buttons within the swf to be recognised and so too the associated function of that button - but if the div is clicked on anywhere else other than the button, it drags...
any ideas?
- uan0
make a drag-and-drop area...and a swf area...
...sounds like you have double-functionality for the click, one in js and the other in the swf...how are you catching the click in the swf? if it gets the on(rollover), maybe it catches the on(press) or the on(release, releaseOutside), maybe with eventListener...
- wwfc0
...the onclick for the drag and drop seems to take control and president over the swf - it ignores the click functionality (press/release etc...) of any buttons and also any input type fields too - would an event listener get around that?
- neverblink0
you might have to create a 'drag area' on the div, much like the titlebar of browserwindow.
- wwfc0
...how can I do that? I have tried to create a draggable area and a swf play area, but not with any success :-(
- neverblink0
I mean, something like..
<div class="draggable" id="swfcontainer1">
<a onmousedown="startdrag('swfcontainer1')" onmouseup="stopdrag('swfcontainer1')">drag me</a>
<object... swf goes here .../object>
</div>
- wwfc0
...hmm... thanks neverblink - but I don't seem to get that working!
:-(