473,624 Members | 2,543 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.macrom edia.com/pub/shockwave/cabs/flash/swflash.ca
b#version=7,0,1 4,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="allowScri ptAccess" value="sameDoma in">
<embed id="tabMenu" name="tabMenu" src="tabMenu.sw f"
menu="false" quality="best" wmode="opaque"
base="file://C:/WINDOWS/Desktop/031122a/" bgcolor="#FFFFF F"
swLiveConnect=" true" allowScriptAcce ss="sameDomain "
width="720" height="420"
type="applicati on/x-shockwave-flash"
pluginspage="ht tp://www.macromedia. com/go/getflashplayer" ></embed>
</object>

I'm using Netscape 7.1.

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

Any help will be appreciated.

Thanks

gsb
Jul 20 '05 #1
3 4274
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.macrom edia.com/pub/shockwave/cabs/flash/swflash.ca
b#version=7,0,1 4,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="allowScri ptAccess" value="sameDoma in">
<embed id="tabMenu" name="tabMenu" src="tabMenu.sw f"
menu="false" quality="best" wmode="opaque"
base="file://C:/WINDOWS/Desktop/031122a/" bgcolor="#FFFFF F"
swLiveConnect=" true" allowScriptAcce ss="sameDomain "
width="720" height="420"
type="applicati on/x-shockwave-flash"
pluginspage="ht tp://www.macromedia. com/go/getflashplayer" ></embed>
</object>

I'm using Netscape 7.1.

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

document.getEle mentById("tabMe nu").offsetLe ft
and
document.getEle mentById("tabMe nu").offsetTo p
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 ("offsetPare nt node: closest
positioned containing element within the DOM node containment hierarchy").

To reference an element, use document.getEle mentById 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.offs etParent)!=null ) { ol+=o.offsetLef t;} return ol }
function getOffsetTop (o) { var ot=o.offsetTop;
while((o=o.offs etParent)!=null ) { ot+=o.offsetTop ;} return ot }
function libGetLoc(o) { var c=new
Object();c.x=ge tOffsetLeft(o); c.y=getOffsetTo p(o);return c }

loc = libGetLoc( document.getEle mentById("tabMe nu") );

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.offs etParent)!=null ) { ol+=o.offsetLef t;} return ol }
function getOffsetTop (o) { var ot=o.offsetTop;
while((o=o.offs etParent)!=null ) { ot+=o.offsetTop ;} return ot }
function libGetLoc(o) { var c=new
Object();c.x=ge tOffsetLeft(o); c.y=getOffsetTo p(o);return c }

loc = libGetLoc( document.getEle mentById("tabMe nu") );

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
2024
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 there any way I can attach that window with an object variable in javascript? Because I want to communicate with that window. Thank you in advance! Jack
2
1921
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 classid='CLSID:7FA62735-AHC3-14d2-9F81-00114B3245C5
1
1501
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 I blow out with "An unhandled exception of type 'System.ArgumentException' occurred" Dim myRange As Word.Range = oWord.ActiveDocument.Content With myRange.Find ..ClearFormatting()
26
5663
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 several parts of the DOM, but this does not include the window object. Thank you
35
2283
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; unitPrice=document.RFO.unitPrice.value; total=0; if(isPositiveInteger(quantity)) {
7
1966
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 isn't very useful if you want to fetch information from an existing document in the window. One solution I came up with was quite simple; open the "new" window, giving you a reference to the object, then use window.history.back() to
2
2373
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 desired key it shows its ascii value in cmd prompt.. i want the window object to hide or dissable. let me know if u have any idea regarding that!!
2
1804
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" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="500" height="500" > <param name="MOVIE" value="main.swf"/> <param name="PLAY" value="true"/> <param name="LOOP" value="true"/> <param name="QUALITY" value="high"/>
0
8249
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8633
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8493
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7176
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6112
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1797
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1493
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.