[xul-interop] How to get image width?

Tom Brito <[email protected]> Fri, 8 Oct 2010 14:27:31 -0300
Newsgroups gmane.comp.lang.xul.general
Message-ID <[email protected]>
--===============0836080968589906971==
Content-Type: multipart/alternative; boundary=0016364c79b581107804921e54e1

--0016364c79b581107804921e54e1
Content-Type: text/plain; charset=ISO-8859-1

Hi!

I'm working with images, and if I don't specify an width and height to an
image it fits the exactly size of the image (didn't tested for images larger
then the screen).

What I would like to do is get the width of this loaded image, so I can
calculate to put it in the center of the screen with (screen/width/2 -
image.width/2),
any idea how to get loaded image's width?

Trying with:

var image = getElementById('loadingImage');


image.width returns nothing..


*
Wellington B. de Carvalho
*

--0016364c79b581107804921e54e1
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi!<div><br></div><div>I&#39;m working with images, and if I don&#39;t spec=
ify an width and height to an image it fits the exactly size of the image (=
didn&#39;t tested for images larger then the screen).</div><div><br></div>

<div>What I would like to do is get the width of this loaded image, so I ca=
n calculate to put it in the center of the screen with (screen/width/2 - im=
age.width/2),</div><div>any idea how to get loaded image&#39;s width?</div>

<div><br></div><div>Trying with:</div><blockquote class=3D"webkit-indent-bl=
ockquote" style=3D"margin: 0 0 0 40px; border: none; padding: 0px;"><div><f=
ont class=3D"Apple-style-span" face=3D"&#39;courier new&#39;, monospace">va=
r image =3D getElementById(&#39;loadingImage&#39;);</font></div>

</blockquote><div><br></div><div><font class=3D"Apple-style-span" face=3D"&=
#39;courier new&#39;, monospace">image.width</font> returns nothing..</div>=
<div><div><br></div><div><br></div><i><div style=3D"text-align:left"><span =
style=3D"font-style:normal"><i>Wellington B. de Carvalho</i></span></div>

</i><br>
</div>

--0016364c79b581107804921e54e1--


--===============0836080968589906971==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
--===============0836080968589906971==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
XUL News Wire      - http://xulnews.com
XUL Job Postings   - http://xuljobs.com
Open XUL Alliance - http://xulalliance.org  
_______________________________________________
xul-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xul-talk

--===============0836080968589906971==--