Link to home
Start Free TrialLog in
Avatar of Madkhali
MadkhaliFlag for United States of America

asked on

problem loading external swf and errors, urgent please

first of all, many thanks to every one who is helping people around :)

The files:
http://www.4shared.com/file/90577186/11f7a94e/FLAs.html

in the link below a sample of the FLAs i am working on.
i faced some errors and overlapping objects

what is in the link:
- it is rar file, i convert it to txt, please re-change it to rar file extension.
- inside: main: main fla, it loads other SWFs
- loaded SWFs:  , section1, section5, sec1. these SWFs are from section 1 to section6 as well sec1 to sec6. but i included three to make the size smaller, please duplicate them if needed.
- two folders that contain AS3 classes.

the problems:
1- if you test the main.swf, and from the main menu you clicked any sub button, lets say section5, the following error appears:

ReferenceError: Error #1065: Variable event is not defined.
      at main_fla::MainTimeline/loadSection()
      at section1_fla::MainTimeline/frame47()

2- if you test any section alone with out main.swf, the following error appears:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at section1_fla::MainTimeline/frame47()

3- there is a button in the bottom left "Canada", it tells the time line to play to go to "Canada" section, as well as USA button to play the main time line and go back to frame 15, which is the USA section again.

in frame 20, i removed the current loaded swf, so i can place a new swf for Canada section:
container.removeChild(containerLoader);

is it the right way, according to the ram issue?

4- if you are in Canada section, main.swf will load the sec1.swf as default file. please click any sub section from the menu, lets say sec2. sec1 goes off the stage and there is nothing happens after that. the main.swf must loads the swf related to to the button, sec2.

if you click sec3, it will load sec1 again, this happens to every button.

5- go back to USA: when the user click the USA button to go back, the play head plays until frame 30 to remove current loaded swf and load the default swf for USA, but there is over lapping.:
container.removeChild(containerLoader2);
container.addChild(containerLoader);

please press Canada and USA in this order:
Canada - USA - Canada ... and so on
you will notice overlapping SWFs

Thanks for your time reading this thread.
Avatar of blue-genie
blue-genie
Flag of South Africa image

your files are a tad huge - limited bandwidth here.
if not one else climbs on board, will you have to just provide code snippets where you're getting problems.
otherwise i'll have to download when i get home - can't use office bandwidth.
Avatar of Madkhali

ASKER

no problem, download it at home
i need it to day please, i am out of time

thanks so much for your help
Hi again :)
is there any problem opening the FLAs?

if you want to separate my questions in several threads, no problem :)
so you can deal with easily

Thanks
okay here's my thoughts.

1. when I first run main.swf - I get a unhandled IOErrorEvent - you just need to put one in to catch errors for URL not found.
if i click on section 5 I don't get the error you refer to with Event Not found -  i get the standard 1009 error of referencing a null object. In your case it doesn't know what midFrame is - where are you setting that?
- containerLoader.content.midframe
it doesn't help to test the items separately when they're meant to be a part the whole - then you will get errors as you're referencing stuff it can't access.


2. removeChild - yes that's fine

3. when i click the USA or Canada links - it plays a little fading animation then I get error for URL not found. I don't see where you're loading anything.
Thanks for your reply

please solve these problems. i am new to AS3 :(

i will try to simplfy the condition

you must have these SWFs:
for USA section:
section1.swf
section2.swf
section3.swf
section4.swf
section5.swf
section6.swf

for CANADA section:
 sec1.swf
sec2.swf
sec3.swf
sec4.swf
sec5.swf
sec6.swf

please copy any swf and rename it to match the list


//Error #1065 --------------------------------------------------------------------------------------------
1. make test for main.fla

2. main.swf will load section1.swf

3. click from the menu section2

4. main.swf will load section2.swf, but this error will appear:

ReferenceError: Error #1065: Variable event is not defined.
    at main_fla::MainTimeline/loadSection()
    at section1_fla::MainTimeline/frame47()

 same error appears for every loaded swf


//Error #1009---------------------------------------------------------------------------------------------
1. open section1.fla, or any loaded FLAs

2. make test.

3. the contents comes to stage and stop.

4. press enter, the contents disappears and this error appears:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at section1_fla::MainTimeline/frame47()


//CANADA section---------------------------------------------------------------------------------------
1. click Canada button

2. fading will play, and sec.swf will be loaded by default

3. click section2 from the menu

4. sec1.swf will go off the satge, after that main.swf must load sec2.swf, but nothing happen, insted you will get this error again:
 
ReferenceError: Error #1065: Variable event is not defined.
    at main_fla::MainTimeline/loadSection()
    at sec1_fla::MainTimeline/frame43()
 
 5. from the menu click secion5, it will load sec1.swf insted of sec5.swf, this happens to every button.

 please help me to fix it, i do not know how to deal with these error

i need your help, please. i have to handle this project tomorrow.

blue-genie, i owe you my life :)
ok we're getting close.

problem 1.
function loadSection() {
      containerLoader.unload();
      containerLoader.load(new URLRequest(currMovie+".swf"));
      event.target.mouseEnabled = false;
}

there's no event in the scope of this function.
events are for when you set event listeners - you're calling it from you section5.swf file.

in terms of section1 and pressing enter - where is the code that's handling the enter?
also section1 is being loaded into Main so you shouldn't worry too much about what it does when it runs on its own if it has dependencies.

Thanks for your time

but where to put this code?

Thanks for ever :)
please provide me a sample or steps here
there is no sample - you're simply referencing an event where it doesn't exist.
okey, what i have to do to solve it?

please, please
i need your help
tell me what to do

i do not know what to do :(
also, did find solution for this:

//CANADA section---------------------------------------------------------------------------------------
1. click Canada button

2. fading will play, and sec.swf will be loaded by default

3. click section2 from the menu

4. sec1.swf will go off the satge, after that main.swf must load sec2.swf, but nothing happen, insted you will get this error again:
 
ReferenceError: Error #1065: Variable event is not defined.
    at main_fla::MainTimeline/loadSection()
    at sec1_fla::MainTimeline/frame43()
 
 5. from the menu click secion5, it will load sec1.swf insted of sec5.swf, this happens to every button.

time is counting down :(
Thanks :(
if there is no solution please tell me
i am really thinking to rebuild it again to avoid the errors i face
You helped a lot, i do not know how to thank you
everytime you see the error msg

Variable event is not defined. it's the same thing cause you've copied the method and just renamed it.

do you understand what the error is telling you?
when you do an eventListener

i.e btn.addEventListener(MouseEvent.CLICK, doStuff);

function doStuff(evt:Event) {
trace(evt.target);
}

ok so now your method is not a method that is being triggered by an event listener, so event doesn't exist.
so instead of trying to target the event.target simply give it the instance name of the item you're trying to disable.


i do not know how to that
please provide me direct solution

you said:
i.e btn.addEventListener(MouseEvent.CLICK, doStuff);

function doStuff(evt:Event) {
trace(evt.target);
}

how to implement that

please
ASKER CERTIFIED SOLUTION
Avatar of blue-genie
blue-genie
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
dear blue-genie
  thanks again and again :), i am sorry for the long story, the whole code you see is for advanced :) level
 
  i commented this line:
 event.target.mouseEnabled = false;
 and the following error disappeard
  ReferenceError: Error #1065: Variable event is not defined.
    at main_fla::MainTimeline/loadSection()
    at section1_fla::MainTimeline/frame47()
 
 
 please help me to fix the last problem:
 
//CANADA section---------------------------------------------------------------------------------------

 1. click Canada button

2. fading will play, and sec1.swf will be loaded by default

3. click section2 from the menu

4. sec1.swf will go off the satge, after that main.swf must load sec2.swf, insted main.swf will load sec1.swf again.
 
// Going back to USA------------------------------------------------------------------------------------
 
 1. click the usa button
 
 2. main.swf will load section1.swf by default and again main.swf will load section1.swf at the same time
 
 3. click section5 from the menu, this will load section5.swf but section1.swf remain there
 
i would thank our WIZARD in actionscript :)
he really supported me endlessly

i am still have two problems here
https://www.experts-exchange.com/questions/24203345/09030714-Automated-Request-for-Attention-Q-24196260.html
i hope our expert will help me.

THANKS EE
did you sort out your canada problem?
you'll see you've added event listeners to the usaMenu btns but not the canada ones.