473,398 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

HOW TO: Find the Top & Left window offset of an embed'ed [Flash] object.

gsb
I'd like to get the offset coordinates, top & left, of an embedded Flash
movie.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"

codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.ca
b#version=7,0,14,0"
id="tabMenu" width="720" height="420">
<param name="movie" value="tabMenu.swf">
<param name="menu" value="false">
<param name="quality" value="best">
<param name="wmode" value="opaque">
<param name="base" value="file://C:/WINDOWS/Desktop/031122a/">
<param name="bgcolor" value="#FFFFFF">
<param name="allowScriptAccess" value="sameDomain">
<embed id="tabMenu" name="tabMenu" src="tabMenu.swf"
menu="false" quality="best" wmode="opaque"
base="file://C:/WINDOWS/Desktop/031122a/" bgcolor="#FFFFFF"
swLiveConnect="true" allowScriptAccess="sameDomain"
width="720" height="420"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
</object>

I'm using Netscape 7.1.

document.tabmenu.offsetLeft and document.tabmenu.offsetTop don't seem to do
it correctly.

Any help will be appreciated.

Thanks

gsb
Jul 20 '05 #1
3 4249
DU
gsb wrote:
I'd like to get the offset coordinates, top & left, of an embedded Flash
movie.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"

codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.ca
b#version=7,0,14,0"
id="tabMenu" width="720" height="420">
<param name="movie" value="tabMenu.swf">
<param name="menu" value="false">
<param name="quality" value="best">
<param name="wmode" value="opaque">
<param name="base" value="file://C:/WINDOWS/Desktop/031122a/">
<param name="bgcolor" value="#FFFFFF">
<param name="allowScriptAccess" value="sameDomain">
<embed id="tabMenu" name="tabMenu" src="tabMenu.swf"
menu="false" quality="best" wmode="opaque"
base="file://C:/WINDOWS/Desktop/031122a/" bgcolor="#FFFFFF"
swLiveConnect="true" allowScriptAccess="sameDomain"
width="720" height="420"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
</object>

I'm using Netscape 7.1.

document.tabmenu.offsetLeft and document.tabmenu.offsetTop don't seem to do
it correctly.

document.getElementById("tabMenu").offsetLeft
and
document.getElementById("tabMenu").offsetTop
will give the offset values relative to its offsetParent, not necessarly
relative to the document or the browser viewport. offset[Left/Top] is
always relative to the offsetParent node, the node which acts like the
positional context of inner nodes ("offsetParent node: closest
positioned containing element within the DOM node containment hierarchy").

To reference an element, use document.getElementById or another DOM 1
method.

I recommend you read these:

Using Web Standards in Your Web Pages:
Accessing Elements with the DOM
http://www.mozilla.org/docs/web-deve...tml#dom_access

Updating DHTML Web Pages for next generation browsers
http://devedge.netscape.com/viewsour...tml-web-pages/
DU
Any help will be appreciated.

Thanks

gsb


Jul 20 '05 #2
gsb
Basically, that is what I was trying:

function getOffsetLeft(o) { var ol=o.offsetLeft;
while((o=o.offsetParent)!=null) { ol+=o.offsetLeft;} return ol }
function getOffsetTop (o) { var ot=o.offsetTop;
while((o=o.offsetParent)!=null) { ot+=o.offsetTop;} return ot }
function libGetLoc(o) { var c=new
Object();c.x=getOffsetLeft(o);c.y=getOffsetTop(o); return c }

loc = libGetLoc( document.getElementById("tabMenu") );

In Netscape it gives me a wrong 'Top' number, way off. IE is correct.

If I surround all with a DIV tag and get the location of the that tag, both
are correct.

Any thoughts?

Thanks for you time and help.

gsb
Jul 20 '05 #3
DU
gsb wrote:
Basically, that is what I was trying:

function getOffsetLeft(o) { var ol=o.offsetLeft;
while((o=o.offsetParent)!=null) { ol+=o.offsetLeft;} return ol }
function getOffsetTop (o) { var ot=o.offsetTop;
while((o=o.offsetParent)!=null) { ot+=o.offsetTop;} return ot }
function libGetLoc(o) { var c=new
Object();c.x=getOffsetLeft(o);c.y=getOffsetTop(o); return c }

loc = libGetLoc( document.getElementById("tabMenu") );

In Netscape it gives me a wrong 'Top' number, way off. IE is correct.

I don't see how you call your function. I don't see any of your markup
code. No specifics. No url.
"way off" could mean 50px, could mean 500px or could mean 1000px. Here,
I don't even have an idea of magnitude.

If I surround all with a DIV tag and get the location of the that tag, both
are correct.

I don't see any of what you say in your posted messages. So I can not
follow you or reproduce what you see. An url would have been helpful.
Any thoughts?

Thanks for you time and help.

gsb


Is your markup code valid, validated?
Is your code triggering backward compatible rendering mode in MSIE 6 for
windows?
In your initial post, you have 2 distinct elements (object and embed)
with the same id="tabMenu"; now, this is a validation error...
"(...) must be unique in a document."
http://www.w3.org/TR/html401/struct/global.html#adef-id
most likely having consequences on your script function correct behavior.
It's very difficult to recommend anything more without being able to
examine the whole code.

DU
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: datactrl | last post by:
Hi, all Is that possible I can assign an window object variable to an already opened window? With window.open(), we can get a window object from opened window. If a window has already opened, is...
2
by: Phil | last post by:
Hi, I want to access the features of a plugin without actually embedding it into a page. Is this possible? Eg The code to embed the object into a page is: <OBJECT...
1
by: JeffOfJersey | last post by:
I'm trying to develop a dotnet application that uses the Word 11 com object. Whenever I try to use the find object I get a blow out. In the code fragment below executingthe ClearFormating method...
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
35
by: eyoung | last post by:
I call a function that takes the unit price and quantity ordered to create an amount...it looks something like this. function calculateCost() { quantity=document.RFO.quantity.value;...
7
by: multicherry | last post by:
Hi, Having searched for a way to fetch a window object by name, all I came across were answers along the line of... "All you have to do is say windowObj = window.open("blah", "name");" which...
2
by: cpradeepcse | last post by:
hii friends, Is anybody worked on curses module, this is interface for characters and function keys in keyboard to the program.. here it shows a separate window object and after pressing ur...
2
by: Harris Kosmidhs | last post by:
I created a very simple welcome page with xHtml transitional. I tried to get a flash with: <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.