Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Flash Object Causing Browser To Close



I have a flash object that is loading in a iframe on one of my web pages. I have asked two friends to preview the site using IE6 for me and both said that this page caused their browser to close. I have no trouble looking at this page in IE7 and Firefox on my computer. Why would they be having a problem? Here is the site, once there click on Photo Album in the navigation bar:www.robertandsharon.comThanks,Sharon



Adobe > Flash General Discussion
Posted on: 01/29/2007 07:42:04 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

How To Delete A Shared Object On Browser Close?
Hi all !

I am still very new to Flash and I am using Flash MX. Now I have a Flash Navbar and it has an intro animation how the buttons build up and stuff like that

Currently I am using a Shared Object that saves a variable to determine if the user saw the animation before, if so it skips the animation and ony shows how the Navbar looks in the end.

My problem is that whenever you oad the Page it does the animation and everything just fine and afterwards on each other page with the same swf. file (the Navbar) it skips the animation. But when I close my browser and go back to the site after 1 hour or even 10 hours it is supposed to show the animation at the beginning again for which I have to delete that damn SO

Any Ideas how to delete it on browser exit ? Or give it a duration time of like 1 hour ?

Any help would be greatly appreaciated

Thank You
Dan

Deleting Shared Object On Browser Close
I searched for this and did find a similar topic where it was suggested to put a time limit on the shared object (put a time when it was set and compare with time when user accessed the flash again and then decide what to do)

However, I would really like the shared object I am setting to be removed when the browser is closed. Is this possible?

Help Flash Element Causing Browser Compatibility Error
Hello -

Can anyone possibly help with this problem??

I have a site with a Flash movie, a Google Adsense banner, and a regular banner ad. For some reason, the images fail on IE but work on Firefox. I have checked the code and it all looks ok.

Any advice on this would be much apprecaited!!!

the site is : http://www.dotfart.com (well, I never said this was important!)

thanks, Dave!!!

Publish Causing App To Close
ok i have flash professional and when publishing a web page Flash quits unexpectedly. Can anyone help me figure out why? Im running OSX on a 17" powerbook.

thanks!

Help I'm So Close To Getting This Done Photo Gallery Causing A Headache
Please, all you wiser than me, tell me what is wrong with this thing if you have the time. I'm very new to forums in all together, I've been trying to find answers from older posts, but after several hours I just got confused and a headache. This is a vast place! For a girl in small Finland this all just seems rather confusing

My project uses the sliding menu, done according to the tutorial by kirupa, as the base for my whole webpage and I'm trying to add photo gallerys to the different content-movieclips. I created the photo gallery with thumbnails with the help of the brilliant tutorial by kirupa, and put it in it's own movieclip. Workes great! But when I bring it to the whole project one little part of it doesn't work: the hit_left-function. The thumbnail-scrolling doesn't work to the left anymore, only to the right and every other part of the gallery works just fine.

If anyone knows the answer to this, I would appreciate it ever so much! I'm adding the codes for the sliding menu and the photo gallery if you can spot the problem. The web page would be filled with image gallerys because there are so much products I have to list so it would be crusial that people can scroll the thumbnails back aswell.

Code for the sliding menu:


Code:
var currentPosition:Number = contentHold.content1._x;
var startFlag:Boolean = false;
menuSlide = function (input:MovieClip) {
if (startFlag == false) {

startFlag = true;

var finalDestination:Number = input._x;
var distanceMoved:Number = 0;
var distanceToMove:Number = Math.abs(finalDestination-currentPosition);
var finalSpeed:Number = .3;
var currentSpeed:Number = 0;
var dir:Number = 1;

if (currentPosition<=finalDestination) {
dir = -1;
} else if (currentPosition>finalDestination) {
dir = 1;
}

this.onEnterFrame = function() {
currentSpeed = Math.round((distanceToMove-distanceMoved+1)*finalSpeed);
distanceMoved += currentSpeed;
contentHold._x += dir*currentSpeed;
if (Math.abs(distanceMoved-distanceToMove)<=1) {
contentHold._x = maskMovie._x-currentPosition+dir*distanceToMove;
currentPosition = input._x;
startFlag = false;
delete this.onEnterFrame;
}
};
}
};
b1.onRelease = function() {
menuSlide(contentHold.content1);
};
b2.onRelease = function() {
menuSlide(contentHold.content2);
};
b3.onRelease = function() {
menuSlide(contentHold.content3);
};
b4.onRelease = function() {
menuSlide(contentHold.content4);
};
b5.onRelease = function() {
menuSlide(contentHold.content5);
};
b6.onRelease = function() {
menuSlide(contentHold.content6);
};
b7.onRelease = function() {
menuSlide(contentHold.content7);
};
b8.onRelease = function() {
menuSlide(contentHold.content8);
};
b9.onRelease = function() {
menuSlide(contentHold.content9);
};
Code for the photo gallery:


Code:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
thumbnails = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
thumbnails_fn(i);
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
function thumbNailScroller() {
// thumbnail code!
this.createEmptyMovieClip("tscroller", 1000);
scroll_speed = 10;
tscroller.onEnterFrame = function() {
if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
if ((_root._xmouse>=(hit_right._x-40)) && (thumbnail_mc.hitTest(hit_right))) {
thumbnail_mc._x -= scroll_speed;
} else if ((_root._xmouse<=(hit_left._x+40)) && (thumbnail_mc.hitTest(hit_left))) {
thumbnail_mc._x += scroll_speed;
}
} else {
delete tscroller.onEnterFrame;
}
};
}
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = hit_left._x+(target_mc._width+5)*k;
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc.onRollOver = function() {
this._alpha = 80;
thumbNailScroller();
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}

Flash Player Caches Old Version Of SWF In Browser, Causing Incorrect XML Text File To
Hello SitePoint,

I'm trying to stop the Flash Player in a browser from caching my movie, I've tried various posted codes for the HTML and Flash SWF file, but nothing seems to work. This is the setup of my movie:

1) When the main movie starts (there is only 1 movie) I have an intro animation followed by text intro copy in the center of the stage. An ActionScript 2.0 created text field loads the text from an array of imported XML files, and places it in the center of the stage. Movie stops.

2) There are 4 buttons on each side of the stage. When you click each button the text in the center is dynamically replaced by passing another item from the array into the text field.

This script works perfectly in authoring mode. When uploaded to a server the text that appears in the single text field is often incorrect. It's as if the script being displayed is randomly selected from the array of XML files. Every reload of the browser produces a different result.

I also have a text preloader in the Flash file, but I wonder if this is creating more problems. Does anyone know where I can find SIMPLE code for loading an array of XML files - that will be preloaded and not cached on the server - plus code for the "Active Content Update - HTTP" version of the generated HTML file?


Thanks
Charles

Close Browser From Flash
Hi Folks..

I am playing a SWF in the browser..and i have a EXIT button inside the flash, as and when the user clicks on it the current browser should be closed..is it possible using the JavaScript ?? if so plz help me out in this mind boggling thing..

Thanks in advance
rangachamak

[F8] Can I Close A Browser From Flash?
Hey,

I was wondering. Is there a command that allows you to close a browser window? I have a small 200 x 200 window that pops up over my site. I'd like to put a button on the flash file to close the browser. Basically a dummy switch for any user who doesn’t understand it’s a pop up. Is this possible?

Thanks,

Close Browser Window In Flash 5?
Was wondering if anyone knew a script that would allow a Flash button to close the browser window that it is playing in. Any help, links, ideas would be greatly appreciated.

Thanks

Close The Browser Form Flash?
how can I close the browser direct form flash?
on button click?
But not to use,.. JavaScript winClose.

Close Browser Window From Flash
I have a Flash file in a pop-up window launched via JavaScript. In this Flash file is a button to close the window it is showing in (exit button). I'm not sure how to do this, though, since what I tried didn't work.

What is the correct code to close whichever HTML page a Flash file is on from that Flash file?







Attach Code

private function exitListener (e:MouseEvent){
navigateToURL(new URLRequest("javascript:window.close()"));
}

Close Browser Window From Flash
Hi,

How would I create a button within a Flash movie that would stop the movie and close the browser window it it running in? I have a web site demo tour that launches in a new browser window and I want the user to be able to close the window from within the Flash movie when they are finished watching....

Thanks in advance,

Bob

Close Browser Window From Flash
Hi,

How would I create a button within a Flash movie that would stop the movie and close the browser window it it running in? I have a web site demo tour that launches in a new browser window and I want the user to be able to close the window from within the Flash movie when they are finished watching....

Thanks in advance,

Bob

Close Browser Window From Flash
is their a way to close a open browser window from a function or something in flash?

How Do I Close A Browser Window From The Flash Movie
I have tried closing the browser window by attaching the following script to a button;

on (release) {
getURL ("javascript:window.close()");
}


But it dosn't work, neither does;

on (release) {
getURL ("javascript:windowClose()");

}
Is there any other way..??

Close Browser Window With Flash Button?
Hi..have flash movie running in a browser. It has an exit button that i want to close the flash browser window with. How do I do this? I've tried using getUrl with the javascript function parent.close.window but it doesn't work...
This is a relatively simple thing but I have no idea how to do it HEEEEELLLLPPP!!!

Open/close Browser Windows From Flash
Hello,

What I have is 6 buttons in my flash movie. When one is clicked, it opens a sized browser window. Click another, and it opens a different sized window, etc. How do I tell the buttons to close any open windows before opening a different one?

I could only find this code below to close a window, but it doesn't allow the new window to open correctly - it just opens in the size of the previously-clicked window.


on (press) {
getURL("javascript: window.close()");
}
on (release) {

getURL("javascriptpenNewWindow('mm02.htm','thewi n','height=358,width=767,t
oolbar=no,scrollbars=no,status=yes') ");
}


Any help would be appreciated. Thank you.

Close Button On Pop Up Browser Window In Flash Mx
hi there,

wonder if any of you might know the code for a close button on a new browser pop up window in flash?

I'd be really grateful!

Browser Window Won't Close Using Flash Button
So I am trying to close the browser window where my flash movie is embedded with a button action from flash using:

on(release){
getURL("javascript:window.self.close()")
}


I have even tried it with a space between java and script as someone has suggested...but it is not working!!!! Any ideas?
I am using flash mx with a flash 7 swf

Flash Button That Will Close The Browser Window
i have a flash file inside of a page that contains frames....

this is the code i have inside that flash button....

all im trying to do is close the browser window that this site is in...


on (press) {
getURL ("javascript:window.close()");
}


-thanks a million

--manny

Close Browser Window From Flash Button
how do i close the browser window from a flash button? thanks for any help!

Close (all Types Of) Browser Windows From Flash
I've got a swf file embeded in a html file and I'm having troubles finding some actionscript to close the html file (i don't want any popup windows, so i don't want one html file opening the other html file that has the swf embeded in it)

this isn't on a button either it's on the timeline.

I also want this to work in all browsers (at least Explorer, Firefox, Safari and Netscape)

Can anyone help me out?

I've tried

getURL("javascript:window.close(this)");

getURL ("javascript:window.close()");

getURL("close_window()");

getURL("javascript:self.close();");

and these either don't work, or close the window but open another saying "File not found. Can't find the file at close_window()."

Close Pop Up Browser Window In Flash 8 And Javascript
Hey Guys,

I've just created a site in flash 8 and when you click on a certain link on that site a pop up browser window emerges. I have another movie in that pop up browser window along with a close button that needs to close the whole pop up browser window. Can anybody tell me the correct code in flash 8 and javascript that will close the pop up window!!!

thank you

wlsn18

Close Browser Code Updated Into Flash 9
Hi there,

I'm trying to get some old close browser code updated into Flash 9 and am having troubles.

I have this in my index.html file

<script language="JavaScript">
window.open('test.html','1','fullscreen=yes,scrollbar=no');
</script>

and then this code on a button in my flash file to close test.html

on (release) {
getURL("javascript:self.opener=self;self.close();");

}

i've also tried:

"javascript:window.open('','_parent','');window.close();");

and

"javascript:window.close();"

and

"javascript:window.opener=self; window.close()"

and

"JavaScript:self.close();"

but none of these seem to work in Firefox. Can anyone help?

Thanks in advance.





























Edited: 01/22/2008 at 02:40:47 PM by twistedpancreas

Close Browser Window From Flash Movie Button
Was wondering if anyone knew a script that would allow a Flash button to close the browser window that it is playing in. Any help, links, ideas would be greatly appreciated.

[F8/F9] Causing The Browser To Crash
Hi all,

I'm the developer of puzzlebee on facebook, and after a recent code update users began complaining of flash crashing the browser with "Illegal Operation in PlugIn: Shockwave Flash". Nothing really major was changed, so I'm thinking its a certain combination/sequence of regular actionscript causing it.

From feedback it seems to happen in any of the the major browsers and flash players, but I'm unable to reproduce it on any of our computers. For some users it always happens, on others only sometimes. From looking on various threads it appears to be a common problem where certain sites for these users will cause a crash, and I need to get this working even for these users, since it worked before the update.

So I'm asking if anyone knows a configuration of browser, flash version which causes this error?

Even better would be a solution, but I'm sure i could fix quickly it if I could test for it.

Thanks

Stuv

Causing Browser To Run Slow
Hi

I'm making an article viewer i Flash AS3.
For some reason, when the webpage with the flash has been open for a while, the whole system runs slow, and the animation on the flash gets choppy..?


Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, loadXML);
loader.load(new URLRequest("http://wpsites.wiseonlineservices.co...81a67b7542122c"));
var i = 0;
function loadXML(e:Event):void
{

var i:Number = 0;
var xml = new XML(e.target.data);
var xmlArray:Array = new Array();
xmlArray.push(xml.artikkel1.attribute("picture"));
xmlArray.push(xml.artikkel2.attribute("picture"));
xmlArray.push(xml.artikkel3.attribute("picture"));
trace(xmlArray);
var heading1 = xml.artikkel1.attribute("heading");
var heading2 = xml.artikkel2.attribute("heading");
var heading3 = xml.artikkel3.attribute("heading");
var ingress1 = xml.artikkel1.attribute("ingress");
var ingress2 = xml.artikkel2.attribute("ingress");
var ingress3 = xml.artikkel3.attribute("ingress");



headOne_txt.text = heading1;
headTwo_txt.text = heading2;
headThree_txt.text = heading3;
newsOne_txt.text = ingress1;
newsTwo_txt.text = ingress2;
newsThree_txt.text = ingress3;

setInterval(nextArtichle, 4000);

function nextArtichle():void
{
trace(i);
var myloader:Loader= new Loader();
var request:URLRequest = new URLRequest(xmlArray[i]);
myloader.load(request);
picHolder_mc.addChild(myloader);
myloader.alpha = 0.0;

myloader.addEventListener(Event.ENTER_FRAME, alphaUp)
function alphaUp(){
myloader.alpha += 0.1;
}

if(i==0){
new Tween(arrow_mc, "y", Back.easeOut, arrow_mc.y, 9.2, 35, false);
}

if(i==1){
new Tween(arrow_mc, "y", Back.easeOut, arrow_mc.y, 73.2, 35, false);
}

if(i==2){
new Tween(arrow_mc, "y", Back.easeOut, arrow_mc.y, 138.2, 35, false);
}

if(i<2){
i++;
}
else{
i=0;
}

}
nextArtichle();
}

Help Flashvars Causing Browser Slow Down
Hi All,

I have a very simple .swf file that is causing some kind of slow down or memory leak. It is effecting the browser its self as moving the mouse cursor around or selecting text becomes sluggish.

Within the .swf, the stage is only 1px by 1px. It is meant to fit the size of the html element its embedded in. Once the .swf loads it adjusts its stage to the new dimensions. It then draws a rectangle movie clip to fit the new size.

Once the rectangle is drawn the .swf then draws 50 circles of varying size to animate as a snow effect. I wasn't having any slow down until I added this snow effect in. However let me explain in the next paragraph that the snow is not the real culprit.

The rectangles fill, stroke, and corner radius. Can all be set by variables sent to the swf. by the Flashvars attribute of object, and embed. Once they are retrieved by the .swf they are processed by a conditional statement I wrote. If one of the attributes isn't set they are set to a default. The code is attached below.

Heres how I know the snow effect isn't the culprit. If I don't pass the .swf any Flashvars attribute and just let it use the defaults for styleObj in the .swf. The effect runs fine. If I do try to pass it Flashvars the slow down occurs. Is there an issue with my conditional statements?

I have tried embedding using the SwfObject.js Class and using standard HTML tags. Both display the same issue if Flashvars are passed there's a slowdown if not its fine.

If anyone could help with this, or shoot me some links with info I would be eternally grateful. I can also provide the source files if you want to take a look at it.

I have uploaded a test page so you can see the problem in http://www.callmekev.com/client/test/







Attach Code

///////////////////////////////////////////////////////////////////////////
//style object rebuilder checks to see if the styles exists
//if not, it sets them to a default style. If they do exist set them to negative times negative 1
//because they come in as string datatypes from javascript and need to be numbers, the - operater forces datatype change
function rebuildStyleObj():Object{
var styleObj:Object = {
fillC:Number = fillC ? -fillC*-1 : 0x000000,
fillA:Number = fillA ? -fillA*-1 : 32,
strokeW:Number = strokeW ? -strokeW*-1 : 0,
strokeC:Number = strokeC ? -strokeC*-1 : 0x000000,
strokeA:Number = strokeA ? -strokeA*-1 : 100,
rad:Number = rad ? -rad*-1 : 10
};

return styleObj;
};

Can Flash Application Be Viewed In Fullscreen Window Of The Browser With Close Butons
Hi,

Can any one advice if i want to make my flash application work on the browser on fullscreen with the top bar consisting minimise and close button at the top.

now the fullscreen works properly but the bar with minimise and close button does not appear.

I have embedded the 2.swf in 2.html file
and have created another 1.html file to open the file(2.html) containing the swf
In 1.html i have used javascript window.open ('2.html', '','fullscreen=yes, scrollbars=no);
to make the flash file open in full screen
It is opening in full screen but the bar which contain minimise and close button does not show up

Can any body help on this problem

Thanks

2 Questions-Target A Frame In Previous Html/flash Page..and..Script To Close Browser
1) I have a button that opens new html page from my original movie (_blank). If I want to add a button to the New page that targets a 'specific frame' in the 0riginal movie, what is the script. Or can it even be done?

2) Is there a script that will close a browser window from a button?


Thanks,
Mike

Second Post - IE And Pdf In Named Browser Window Causing Errors
Second post - still looking for a solution.

Using getURL and javascript (in a string similar to this sample code
below) to launch a browser window containing a pdf file in IE works
fine, UNLESS you try to open a second pdf using the same named window.
The result is "object expected" errors.

It also seems that you cannot use or close this named window using a
javascript command from flash before opening the second window.

We have also tried converting pdf to Flashpaper files. This works
erratically; on some computers but not others.

There is no issue in Firefox, just IE, which is the browser we must
deliver for.

Has anyone else experienced this? Any idea how to get past this error?

Thanks!

____________________________
Sample code:
getURL
("javascript:NewWindow=window.open('whatever.pdf','newWin2','width=700,height=500,left=400,top=20,toolbar=No,location=No,scrollbars=No,status=Yes,resizable=Yes,fullscreen=No');NewWindow.focus();void(0);");

Swf Object Causing Page Loading Issues
hello all, I have been having bizzare issues with page content not fully loading in IE6 and 7 and it seems some how attached to the allowScriptAccess parameter. I have said parameter set to always as I am using javascript from within flash to show a hidden div and launch a java applet and my swfs reside on another server. But it seems that when I change that allowScript parameter to never the page content loads fine but my javascript doesn't execute. I even moved my swfs to the same server and changed the parametewr to sameDomain and still had the page load issues.

My swfs are published as 8, for reference I had been using this same javascript call but from a version 6 published swf with no problems at all, and it seems to run just dandy in firefox and safari. Any help anyone can lend would be much appriciated.

Close.window Script In Flash Button Quits My Browser Window Or Crashes System
Can somebody please help me?
I have a javascript attached to a button in a .swf file to close the browser window it is in.
The code which was given to me yesterday by senocular is

on(press){
getURL("javascript:window.close()")
}
__

however if you try it IE will unexpectedly quit or bomb my computer.
I tried it in Netscape and it didn't crash.

You can refer to my site http://www.valdesdesign.com
after intro go to print button and then to editorial button.
Editorial opens new window with editorial.swf inside. Click on top right button to close window and see what happens.
Is there something I'm doing wrong? Please help me.
Thanks

Close Browser
Can I close the browser window from within Flash?
thx

To Close Browser....
If I have created a button and want it to close the current browser at release of mouse click, what is the actionscript command for this? Anything you can know about this is greatly appreciated.

Close Browser
You people are brilliant.

At the end of my flash movie (in an html page) i want it to automatically close the browser window it is in. Does anyone know how?
thanks,
dawn

Close Browser
What is the code to close a browser window? I think this is it:
getURL("javascript:self.close()");

but it didn't work for me.

Close Browser
If I have a button, what action script do I have to give it in order for it to close the entire browser window?

I hope someone can help

thanks

Dan

Close Browser
Ok, my apologies because this is probably a really stupid question, but i just cant seem to think of what im supposed to be doing.

Im launching a flash file in a new browser window (as a virtualtour) and want a button in the flash to close the browser window...
What do i need to do?

Thanks for the help!

Browser Close
Is it possible to detect the browser window closing? I've just been chatting with a guy who is adamant that this is possible, but I can't work out how?

Cheers in advance,

Tim

Flash Object Not Lining Up Correctly In Browser
This seems like a stupid problem, but I can't seem to find the answer myself. Hopefully I am posting this in the right forum.

If you go to:

http://site.wallbedfactory.com/test/test.htm

You will see a flash movie and it is aligned to the top left of the window. I would really like it to be displayed after the <p>this is text</p> statements and inside the div with the red border.

Can anyone explain to me how to fix this? Thanks in advance!

Pong Game: GotoAndStop Causing Error #1009: Cannot Access A Property Or Method Of A Null Object Reference.
I'm building a pong game as a way of learning Flash and actionscript 3. Almost have it done.

The game consists of 4 frames: begin, play, win, and lose.

The code for begin works fine and the code for win and lose is the same so I will concentrate on the code for play and lose.

The actual game code in play works fine. Collision detection, score tracking, player paddle movement, AI paddle movment, etc. But there is one problem.

Problem: After the player or the computer gets to 5 points the game is supposed to go to the win or lose frame. I use gotoAndStop for this: gotoAndStop("lose"). This is where I get the "Error #1009: Cannot access a property or method of a null object reference."

From what I can tell it has to do with the gotoAndStop statements that take the player to the win or lose frame. I say this because if I add an End button with an event listener and function call in place of either gotoAndStop statement the End button works properly. It takes me to the win or lose frame (depending on which I target) without an error. But only putting gotoAndStop("frame") in the if statement gives me the error. I want the program to automatically go to the win or lose frame based on the score. I do not want the user to have to click anything.

The code I'm using for the play and lose frames is below.

Any thoughts?







Attach Code

//PLAY FRAME CODE

var playerScore:int = 0;
var computerScore:int = 0;
var relY:int;
var relPerc:Number;
var newDy:Number;

init();

function init(){
//turns off mouse pointer
Mouse.hide();

//gives ball initial direction
ball.dx = 15;
ball.dy = 6;

//Sets the speed of the computer's paddle. Higher speed equals a better
//opponent.
computerPaddle.speed = 8;
}

playerPaddle.addEventListener(Event.ENTER_FRAME, fnPlayerEnterFrame);
computerPaddle.addEventListener(Event.ENTER_FRAME, fnComputerEnterFrame);
ball.addEventListener(Event.ENTER_FRAME, fnBallEnterFrame);

function fnPlayerEnterFrame(event:Event):void{
//Player's paddle follows mouse
playerPaddle.y = stage.mouseY - (playerPaddle.height / 2);
}

function fnComputerEnterFrame(event:Event):void{
//Move the computer's paddle relative to the ball and difficulty
//setting (computerPaddle.speed)
if ((ball.y + (ball.height/2)) < (computerPaddle.y + (computerPaddle.height/2))){
computerPaddle.dy = -computerPaddle.speed;
} else {
computerPaddle.dy = computerPaddle.speed;
}
computerPaddle.y += computerPaddle.dy;
}

function fnBallEnterFrame(event:Event):void{
//move the ball
ball.move();

//check if it hit the top or bottom
ball.checkBoundaries();

//check if it hit a paddle
ball.checkPaddles();
}


ball.move = function(){
ball.x += ball.dx;
ball.y += ball.dy;
}

ball.checkBoundaries = function(){
if (ball.y < 0){
ball.dy = -ball.dy;
}
if (ball.y > stage.stageHeight){
ball.dy = -ball.dy;
}
if (ball.x < 0){
computerScore++;
computerScoreField.text = computerScore.toString();
if (computerScore >= 5){
gotoAndStop("lose");
}

ball.x = computerPaddle.x-50;
ball.y = computerPaddle.y + (computerPaddle.height / 2);

ball.dy = 0;
}

if (ball.x > stage.stageWidth){
playerScore++;
playerScoreField.text = playerScore.toString();

if (playerScore >= 5){
gotoAndStop("win");
}

ball.x = playerPaddle.x + 50;
ball.y = playerPaddle.y + (playerPaddle.height / 2);
ball.dy = 0;

}
}

ball.checkPaddles = function(){
if (ball.hitTestObject(playerPaddle)){
ball.dx = -ball.dx;
ball.dy = getDy(playerPaddle);
}
if (ball.hitTestObject(computerPaddle)){
ball.dx = -ball.dx;
ball.dy = getDy(computerPaddle);
}
}

function getDy(paddle){
relY = (ball.y + (ball.height/2)) - (paddle.y + (paddle.height/2));

relPerc = relY / paddle.height;

newDy = relPerc * 30;

return newDy;
}



//LOSE FRAME CODE

Mouse.show();

btnPlay.addEventListener(MouseEvent.CLICK, fnPlay);

Close Browser Window
Hello,

Does anybody know if there is a script for a button that will close the browser window in which the swf is playing?

Emily

Close Browser Window
Hello,

Does anybody know if there is a script for a button that will close the browser window in which the swf is playing?

Emily

Close The Browser Window
How can i insert a flash movie in a html page with a button to close de browser window?

Is there any way without using flash extensions?
Can use javascript? How?

Thank's./Pedro

Close Browser Window
a really quick questions, if someone can hook me up.

the site im building loads a popup window with a flash site. in the flash site there's a "quit" button. what action script can i use on the button so that when clicked, the popup window closes and the parent window refershes to another url.

thanks

Close Browser Window
I have created a flash site when you click on a pop up window its centered in the middle of the screen. I can't seem to figure out how to close the window when I click in the browser window. You can see the draft of the site at Spirit Beanies click on Samples then Styles choose anyone of the caps. They all appear in the center of the screen. So I want people to have the ability to click on a cap & it closes the previous cap opened or just close the browser without clicking on the X in the upper right hand corner of the browser window.

Thanks in advance for the help.

Deb

Close Windows Browser
Hi there,

I create an button in my flash movie ( embed in browser )

Any action scripts can be used to close the Windows?

Cheers

How Do You Close A Swf Browser Window
In my movie I have a button that when clicked, another browser window is launched. I've figured out how to stop the sounds and movie from playing once the other window has opened, but I'd like to close the swf window somehow, even though it's covered up behind the new browser window that opens infront of it.

Thanks!

Copyright © 2005-08 www.BigResource.com, All rights reserved