Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Supporting Technologies > HTML and JavaScript

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-12-2004, 12:51 PM   #1
Ruben
Me
 
Ruben's Avatar
 
Join Date: Jul 2002
Location: Netherlands, Europe
Posts: 3,510
Send a message via MSN to Ruben Send a message via Skype™ to Ruben
Default Detect canvas-sizes (NOT screen-sizes)

A warm hello to all, am I the first person to post a thread here??

Anyways, here's the situation:

If you'd have a flash-movie (sized 100% by 100%) embedded in a html-file and in the flash-movie there'd be a textbox displaying Stage.width and Stage.height then when I view the movie the text would be "976 x 753"...

Now my question is, could I get that values by detecting the canvas-sizes using javascript?

To clear things out: I'm NOT looking for flashmovies passing through values to htmlfiles. I only want to know if there is a way for javascript to check what the height and width of the canvas are, NOT the whole screen or anything, just the sizes of the space where my website is displayed...

- Ruben
__________________
.
Originally Posted by MichaelxxOA
"He sounded like he knew which words he was going to use before he knew what he was going to say. I hate that shit."
Ruben is offline   Reply With Quote
Old 07-12-2004, 02:58 PM   #2
Timmee_3Styler
Canadian Flasher
 
Join Date: May 2002
Location: T dot O dot
Posts: 1,651
Default

Ruben - http://www.actionscript.org/forums/s...d.php3?t=50541

around the same principles?
Timmee_3Styler is offline   Reply With Quote
Old 07-12-2004, 03:10 PM   #3
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,048
Default

uhmmm, if your swf is set to 100%X100%, wouldn't that be the screen size?
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Old 07-12-2004, 03:24 PM   #4
Ruben
Me
 
Ruben's Avatar
 
Join Date: Jul 2002
Location: Netherlands, Europe
Posts: 3,510
Send a message via MSN to Ruben Send a message via Skype™ to Ruben
Default

Quote:
Originally Posted by Timmy_3Styler
Ruben - http://www.actionscript.org/forums/...ad.php3?t=50541

around the same principles?
Thanks Timmy, but I'm not looking for scaling and sizes of 100% and stuff...I know how to do that...I'm looking for a way to read the px-size of the stage using javascript...

But thanks anyways

Quote:
Originally Posted by tg
uhmmm, if your swf is set to 100%X100%, wouldn't that be the screen size?
Well, the problem is that (for some weird-arse reason) FireFox won't read
Code:
width = "100%"
height = "100%"
...so I was wondering if I could see how many pixels the "100%" would mean for the height and width...because FireFox CAN read the sizes in pixels...

Thanks anyway

- Ruben
__________________
.
Originally Posted by MichaelxxOA
"He sounded like he knew which words he was going to use before he knew what he was going to say. I hate that shit."
Ruben is offline   Reply With Quote
Old 07-12-2004, 04:18 PM   #5
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,048
Default

right, gothcha, i don't do much with 100%, so i don't so if this sounds kinda sarcastic, its not meant to.


so if you use javascript to find window.innerHeight, and window.innerWidth, then that might give your the same size as your stage (but i don't know for sure). innerWidth/height should work for nav4+, so might work for mozilla/firefox. but it won't work for ie.
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Old 07-12-2004, 05:28 PM   #6
Ruben
Me
 
Ruben's Avatar
 
Join Date: Jul 2002
Location: Netherlands, Europe
Posts: 3,510
Send a message via MSN to Ruben Send a message via Skype™ to Ruben
Default

Quote:
Originally Posted by tg
right, gothcha, i don't do much with 100%, so i don't so if this sounds kinda sarcastic, its not meant to.

so if you use javascript to find window.innerHeight, and window.innerWidth, then that might give your the same size as your stage (but i don't know for sure). innerWidth/height should work for nav4+, so might work for mozilla/firefox. but it won't work for ie.
Thanks alot man! I can't test it because I haven't got firefox installed, my boss does, so I'll have to wait untill he comes online...but thanks anyway

So while we're at the browser-topic:

I got this piece of javascript from kirupa to check what browser the user's using:
Code:
function checkBrowser() {
var IE = document.all;
var oldNS = document.layers;
var newNS = !document.all && document.getElementById;
var opera = window.opera;
if (opera) {
  window.location = "opera.html";
} else if (oldNS) {
  window.location = "oldns.html";
} else if (newNS) {
  window.location = "newns.html";
} else if (IE) {
  window.location = "ie.html";
  };
};
I was wondering: what browsers do oldNS and newNS stand for? And is there a way to check if someone is using firefox??

Thanks alot for reading/replying - Ruben
__________________
.
Originally Posted by MichaelxxOA
"He sounded like he knew which words he was going to use before he knew what he was going to say. I hate that shit."
Ruben is offline   Reply With Quote
Old 07-12-2004, 05:40 PM   #7
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,048
Default

just a guess, i'm not positive, but i'ld say <= net5
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Old 07-12-2004, 05:52 PM   #8
Ruben
Me
 
Ruben's Avatar
 
Join Date: Jul 2002
Location: Netherlands, Europe
Posts: 3,510
Send a message via MSN to Ruben Send a message via Skype™ to Ruben
Default

Quote:
Originally Posted by tg
just a guess, i'm not positive, but i'ld say <= net5
I lost you, come again?

- Ruben
__________________
.
Originally Posted by MichaelxxOA
"He sounded like he knew which words he was going to use before he knew what he was going to say. I hate that shit."
Ruben is offline   Reply With Quote
Old 07-12-2004, 05:55 PM   #9
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,048
Default

hehheh.

oldNS=all netscape browsers older than (and including) netscape 5.
newNS=all netscape/mozilla browsers based on netscape code newer than netscape 5 browser

again... i'm not positive about the number, but i think mozilla is based on the netscape 6 gecko engine, so thats why i figured 5 as the cuttoff for old.... maybe its 6 ... not sure.
__________________
tg
---
what the hell was i thinking?

Last edited by tg; 07-12-2004 at 05:57 PM..
tg is offline   Reply With Quote
Old 07-12-2004, 06:55 PM   #10
Ruben
Me
 
Ruben's Avatar
 
Join Date: Jul 2002
Location: Netherlands, Europe
Posts: 3,510
Send a message via MSN to Ruben Send a message via Skype™ to Ruben
Default

Oh, glad you could clear that one out for me, thanks heaps...

So no-one knows how I can check wether or not the user is viewing through FireFox??

- Ruben

PS. I keep asking, don't I?
__________________
.
Originally Posted by MichaelxxOA
"He sounded like he knew which words he was going to use before he knew what he was going to say. I hate that shit."
Ruben is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:04 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.