Question : access load swf outside of loader function

hi all i am making an image gallery on a website and there are 5 different galleries in five separate swf files. What i would like to do is tween between the different swfs once they are loaded. So far I have loaded the swfs and can add tweener effects from within the onCompleteHandler load event function but when i try to remove child or tween outside of the load event function  i get


1120: Access of undefined property loadEvent.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438:
439:
440:
441:
442:
443:
444:
445:
446:
447:
448:
449:
450:
451:
452:
453:
454:
455:
456:
457:
458:
459:
460:
461:
462:
463:
464:
465:
466:
467:
468:
469:
470:
471:
472:
473:
474:
475:
476:
477:
478:
479:
480:
481:
482:
483:
484:
485:
486:
487:
488:
489:
490:
491:
492:
493:
494:
495:
496:
497:
498:
499:
500:
501:
502:
503:
504:
505:
506:
507:
508:
509:
510:
511:
512:
513:
514:
515:
516:
517:
518:
519:
520:
521:
522:
523:
524:
525:
526:
527:
528:
529:
530:
531:
532:
533:
534:
535:
536:
537:
538:
539:
540:
541:
542:
543:
544:
545:
546:
547:
548:
549:
550:
551:
552:
553:
554:
555:
556:
557:
558:
559:
560:
561:
562:
563:
564:
565:
566:
567:
568:
569:
570:
571:
572:
573:
574:
575:
576:
577:
578:
579:
580:
581:
582:
583:
584:
585:
586:
587:
588:
589:
590:
591:
592:
593:
594:
595:
596:
597:
598:
599:
600:
601:
602:
603:
604:
605:
606:
607:
608:
609:
610:
611:
612:
613:
614:
615:
616:
package {
	
	//Import relevant ActionScript Libs
	import flash.events.*;
	import flash.display.*;
	import flash.filters.BlurFilter;
	import flash.net.URLRequest;
	import flash.display.Loader;
	import flash.events.ProgressEvent;
	import flash.display.Sprite;
	
	
	//Tweener Lib
	import caurina.transitions.*;
	import caurina.transitions.properties.FilterShortcuts;
	FilterShortcuts.init();

	
	
	public class goodTimesAS3 extends MovieClip {
		
		
					//Load in MovieClips and instantiate (BACKGROUNDS)
					private var entrance:entranceBg_mc = new entranceBg_mc();
					private var desk:deskBg_mc = new deskBg_mc();
					private var studio:studioBg_mc = new studioBg_mc();
					private var drawing:drawingBg_mc = new drawingBg_mc();
					private var shrine:shrineBg_mc = new shrineBg_mc();
					
					
					//Load in MovieClips and instantiate (LOGO & CONTENT)
					private var logo:goodLogo_mc = new goodLogo_mc();
					private var deskInfo:deskInfo_mc =  new deskInfo_mc();
					private var rightArrow:rightArrow_mc = new rightArrow_mc();
					private var rightArrow2:rightArrow_mc = new rightArrow_mc();
					private var leftArrow:leftArrow_mc = new leftArrow_mc();
					private var leftArrow2:leftArrow_mc = new leftArrow_mc();
					private var merchDoor:studioDoorCutout_mc = new studioDoorCutout_mc();
					
					private var mercText:mercText_mc = new mercText_mc();
					
					//Load in people MovieClips
					private var saira:saira_mc = new saira_mc();
					private var nick:nick_mc = new nick_mc();
					private var jamie:jamie_mc = new jamie_mc();
					private var nikole:nikole_mc = new nikole_mc();
					private var danny:danny_mc = new danny_mc();
					
					private var saira2:saira_mc = new saira_mc();
					private var nick2:nick_mc = new nick_mc();
					private var jamie2:jamie_mc = new jamie_mc();
					private var nikole2:nikole_mc = new nikole_mc();
					private var danny2:danny_mc = new danny_mc();
					
					
					private var maskWindow:mask_mc = new mask_mc();
					private var maskWindow2:mask_mc = new mask_mc();
					
					private var sairaContent:sairaContent_mc = new sairaContent_mc();
					private var nickContent:nickContent_mc = new nickContent_mc();
					private var jamieContent:jamieContent_mc = new jamieContent_mc();
					private var nikoleContent:nikoleContent_mc = new nikoleContent_mc();
					private var dannyContent:dannyContent_mc = new dannyContent_mc();
					
					
					
					
					//Start blur settings for desk
					private var myBlurFilter = new BlurFilter (10,10,3);
					
					
					//Set string var for people tween
					private var currentPage:String = "nikoleContent";
	
					
					public function goodTimesAS3() {
						
						//Position and add elements to the stage
						stage.addChild(desk);
						desk.x = 606.15;
						desk.y = 390.10;
						desk.width = 1720;
						desk.height = 1150.80

						stage.addChild(entrance);
						entrance.x = 597;
						entrance.y = 398;
						
						stage.addChild(logo);
						logo.x = 580;
						logo.y = 274;
						//Add event listener for entrance animation to begin (Runs function goInside)
						logo.addEventListener(MouseEvent.MOUSE_OVER, goInside);
						
						
						//Add studio bg to stage
						stage.addChild(studio);
						studio.x = 1200;
						studio.y = 0;
						
						
						stage.addChild(rightArrow);
						rightArrow. x = 1161.3;
						rightArrow. y = 349.10;
						rightArrow.addEventListener(MouseEvent.CLICK, moveRight);
						
						
						
						
						
				}
				
				public function goInside(e): void {
					
						//Remove Logo
						stage.removeChild(logo);
						logo.removeEventListener(MouseEvent.MOUSE_OVER, goInside);
						
						
						//Scale entrance and drop alpha
						Tweener.addTween (entrance, {_Blur_blurX: 10, _Blur_blurY: 10, _Blur_quality:2, time:0.4, transition:"easeOutSine"});
						Tweener.addTween (entrance, {width:1660 , height:1110, time:0.4, transition:"easeOutSine"});
						Tweener.addTween (entrance, {alpha:0, time:0.6, transition:"easeOutSine"});
						
						//Fade desk in and scale oncomplete run enter content funtion
						Tweener.addTween (desk, {width:1260, height:843, time:0.4, delay: 0.1, transition:"easeOutSine", onComplete: enterContent});
						
					
					
					}
					
					
				//Display Content	
				public function enterContent() {
					
						stage.addChild(deskInfo);
						deskInfo.x = 241.30;
						deskInfo.y = 74.20;
						deskInfo.filters = [myBlurFilter];
						Tweener.addTween (deskInfo, {_Blur_blurX: 0, _Blur_blurY: 0, _Blur_quality:2, time:0.8, transition:"easeOutSine"});
						Tweener.addTween (deskInfo, {x:190.30, time:0.8, transition:"easeOutSine"});
						
						//Add arrow to stage and attach event listener
						stage.addChild(leftArrow);
						leftArrow. x = 40;
						leftArrow. y = 349.10;
						leftArrow.addEventListener(MouseEvent.CLICK, moveLeft);
						
				}
				
				
			public function moveLeft(e): void {
				
				stage.removeChild(deskInfo);
				
				
				stage.addChild(shrine);
				shrine.x = -1292.40;
				shrine.y = -28.35;
				Tweener.addTween(desk, {x:1828, time:0.6, transition:"easeOutSine"});
				Tweener.addTween(deskInfo, {x:1828, time:0.6, transition:"easeOutSine"});
				Tweener.addTween(shrine, {x:-50.10, time:0.6, transition:"easeOutSine", onComplete: addGallery});
				Tweener.addTween (shrine, {_Blur_blurX: 10, _Blur_blurY: 10, _Blur_quality:2, time:0, transition:"easeOutSine"});
				Tweener.addTween (shrine, {_Blur_blurX: 0, _Blur_blurY: 0, _Blur_quality:2, time:0.6, transition:"easeOutSine"});
				
				
				
				
			}
			
			
			
		public function addGallery() {
					
					stage.addChild(rightArrow2);
					rightArrow2. x = 1161.3;
					rightArrow2. y = 349.10;
					
					
					
					stage.addChild(danny2);
						danny2.x = 160;
						danny2.y = 300;
						danny2.addEventListener(MouseEvent.CLICK, clickHandlerOne2);
							function clickHandlerOne2(e:MouseEvent):void {
									
								}
						
						stage.addChild(jamie2);
						jamie2.x = 160;
						jamie2.y = 400;
						jamie2.addEventListener(MouseEvent.CLICK, clickHandlerTwo2);
							function clickHandlerTwo2(e:MouseEvent):void {
								
								
								//////////////////////////
							
									
								}
						
						
						stage.addChild(saira2);
						saira2.x = 230;
						saira2.y = 290;
							saira2.addEventListener(MouseEvent.CLICK, clickHandlerThree2);
								function clickHandlerThree2(e:MouseEvent):void {
										
									}
						
						
						stage.addChild(nick2);
						nick2.x = 230;
						nick2.y = 390;
						nick2.addEventListener(MouseEvent.CLICK, clickHandlerFour2);
								function clickHandlerFour2(e:MouseEvent):void {
										
									}
						
						stage.addChild(nikole2);
						nikole2.x = 160;
						nikole2.y = 220;
						nikole2.addEventListener(MouseEvent.CLICK, clickHandlerFive2);
								function clickHandlerFive2(e:MouseEvent):void {
										
									}
					
					
					
					/*Load in external swf */
				var loadSwf:Loader = new Loader();
				var requestSwf:URLRequest = new URLRequest("photo_gallery.swf");
				loadSwf.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
				loadSwf.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
				

				loadSwf.load(requestSwf);
				
				
				
				var loadSwfNick:Loader = new Loader();
				var requestSwfNick:URLRequest = new URLRequest("photo_galleryNick.swf");
				loadSwfNick.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandlerNick);
				//loadSwfNick.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandlerNick);
				

				loadSwfNick.load(requestSwfNick);
				
				
				
				/* Add swf to stage */
				function onCompleteHandler (loadEvent:Event) {
					
					
					
					stage.addChild(loadEvent.currentTarget.content);
					loadEvent.currentTarget.content.mask = maskWindow;
					loadEvent.currentTarget.content.x = 400;
					loadEvent.currentTarget.content.y = 200;
					loadEvent.currentTarget.content.alpha = 0;
					Tweener.addTween(loadEvent.currentTarget.content, {alpha:1, time:0.6, transition:"easeOutSine"});
					
					
					
					
					maskWindow.x = 400;
					maskWindow.y = 200;
					
					rightArrow2.addEventListener(MouseEvent.CLICK, backRight)
					
					//stage.removeChild(loadEvent.currentTarget.content);
				}
				
				/* Progress tracking*/
				function onProgressHandler(mProgress:ProgressEvent) {
					var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
					trace (percent);
				}
				
				
				
				function onCompleteHandlerNick (loadEvent:Event) { 
				
				stage.addChild(loadEvent.currentTarget.content);
				loadEvent.currentTarget.content.mask = maskWindow2;
				maskWindow2.x = 400;
				maskWindow2.y = -250;
				
				
				loadEvent.currentTarget.content.x = 400;
				loadEvent.currentTarget.content.y = -250;
				
				
				
				}
				
				}	
			
			
			
			
			
			public function backRight(e): void {
				
				stage.removeChild(rightArrow2);
				rightArrow2.removeEventListener(MouseEvent.CLICK, backRight)
				
				
				stage.addChild(deskInfo);
				deskInfo.x = 241.30;
				deskInfo.y = 74.20;
				deskInfo.alpha = 0;
				deskInfo.filters = [myBlurFilter];
				Tweener.addTween (deskInfo, {_Blur_blurX: 0, _Blur_blurY: 0, _Blur_quality:2, time:0.8, delay:0.6, transition:"easeOutSine"});
				Tweener.addTween (deskInfo, {x:190.30, alpha:1, time:0.8, delay:0.6, transition:"easeOutSine"});
				
				
				//loadEvent.parent.removeChild(loadEvent.currentTarget.content);
				
				
				Tweener.addTween(shrine, {x:-1292.40, time:0.6, transition:"easeOutSine", onComplete: function() { stage.removeChild(shrine); }});
				Tweener.addTween(desk, {x:606.15, time:0.6, transition:"easeOutSine"});
				
				
				
				
				
				
				
			}
				
				
			public function moveRight(e): void {
				
						//Remove Desk Content
						stage.removeChild(deskInfo);
						stage.removeChild(rightArrow);
						stage.removeChild(leftArrow);
						
						
						//Blur studio
						studio.filters = [myBlurFilter];
						//Animate between backgrounds		
						Tweener.addTween(studio, {x:0, time:0.6, transition:"easeOutSine"});
						Tweener.addTween(studio, {_Blur_blurX: 0, _Blur_blurY: 0, _Blur_quality:2, time:0.6, delay:0.3, transition:"easeOutSine"});
						Tweener.addTween(desk, {x:-632.15, _Blur_blurX: 10, _Blur_blurY: 10, _Blur_quality:2, time:0.6, transition:"easeOutSine", onComplete: studioContent  });

				
			}
			
			
			
			public function studioContent() {
				
								
						stage.addChild(leftArrow);
						leftArrow. x = 40;
						leftArrow. y = 349.10;
						leftArrow.addEventListener(MouseEvent.CLICK, backDesk);
						rightArrow.removeEventListener(MouseEvent.MOUSE_OVER, moveRight);
						leftArrow.removeEventListener(MouseEvent.CLICK, moveLeft);
						
						
						
				
				
				
							stage.addChild(dannyContent);
							dannyContent.alpha = 0;
							dannyContent.x = 330;
							dannyContent.y = 20;
							
							stage.addChild(jamieContent);
							jamieContent.alpha = 0;
							jamieContent.x = 330;
							jamieContent.y = 20;
							
							stage.addChild(sairaContent);
							sairaContent.alpha = 0;
							sairaContent.x = 330;
							sairaContent.y = 20;
							
							stage.addChild(nickContent);
							nickContent.alpha = 0;
							nickContent.x = 330;
							nickContent.y = 20;
							
							stage.addChild(nikoleContent);
							nikoleContent.alpha = 1;
							nikoleContent.x = 330;
							nikoleContent.y = 20;
							
							
							
				
						stage.addChild(danny);
						danny.x = 160;
						danny.y = 300;
						danny.addEventListener(MouseEvent.CLICK, clickHandlerOne);
							function clickHandlerOne(e:MouseEvent):void {
									moveOut("dannyContent");
								}
						
						stage.addChild(jamie);
						jamie.x = 160;
						jamie.y = 400;
						jamie.addEventListener(MouseEvent.CLICK, clickHandlerTwo);
							function clickHandlerTwo(e:MouseEvent):void {
									moveOut("jamieContent");
								}
						
						
						stage.addChild(saira);
						saira.x = 230;
						saira.y = 290;
							saira.addEventListener(MouseEvent.CLICK, clickHandlerThree);
								function clickHandlerThree(e:MouseEvent):void {
										moveOut("sairaContent");
									}
						
						
						stage.addChild(nick);
						nick.x = 230;
						nick.y = 390;
						nick.addEventListener(MouseEvent.CLICK, clickHandlerFour);
								function clickHandlerFour(e:MouseEvent):void {
										moveOut("nickContent");
									}
						
						stage.addChild(nikole);
						nikole.x = 160;
						nikole.y = 220;
						nikole.addEventListener(MouseEvent.CLICK, clickHandlerFive);
								function clickHandlerFive(e:MouseEvent):void {
										moveOut("nikoleContent");
									}
									
									
						stage.addChild(merchDoor);
						merchDoor.x = 855.45;
						merchDoor.y = 375;
						merchDoor.addEventListener(MouseEvent.CLICK, merchLoad);
						
				
			}
			
			
				public function merchLoad (e): void {
				
						stage.addChild(drawing);
						drawing.x = 17.30;
						drawing.y = 10.65;
						drawing.alpha = 0;
						
						Tweener.addTween(drawing, {alpha:1, time:0.6, transition:"easeOutSine"});
						
						stage.addChild(mercText);
						mercText.x = 477;
						mercText.y = 264;
						mercText.alpha = 0;
						
						Tweener.addTween(mercText, {alpha:1, time:0.6, delay:0.6, transition:"easeOutSine"});
						
						
						
						leftArrow.removeEventListener(MouseEvent.CLICK, backDesk);
						
						stage.addChild(leftArrow2);
						leftArrow2. x = 40;
						leftArrow2. y = 349.10;
						leftArrow2.addEventListener(MouseEvent.CLICK, backStudio)
						
						
				
				}
				
				
					public function backStudio(e): void {
						
						stage.removeChild(mercText);
						stage.removeChild(leftArrow2);
						
						Tweener.addTween(drawing, {alpha:0, time:0.6, transition:"easeOutSine", onComplete: function() { stage.removeChild(drawing); }});
						leftArrow2.removeEventListener(MouseEvent.CLICK, backStudio)
						leftArrow.addEventListener(MouseEvent.CLICK, backDesk);
						
					}
			
		
			function moveOut (page:String) {
											
				if (page!=currentPage) {
												
					if (currentPage== "nikoleContent") { 
					
					Tweener.addTween(nikoleContent, { onComplete:function() { this.alpha = 0; moveIn(page);}});
					
				}
														
														
					if (currentPage== "sairaContent") { 
					
					Tweener.addTween(sairaContent, { onComplete:function() { this.alpha = 0; moveIn(page);}});
					
				}
														
					if (currentPage== "nickContent") { 
					
					Tweener.addTween(nickContent, { onComplete:function() { this.alpha = 0; moveIn(page);}});
					
				}
				
					if (currentPage== "jamieContent") { 
					
					Tweener.addTween(jamieContent, { onComplete:function() { this.alpha = 0; moveIn(page);}});
					
				}
				
					if (currentPage== "dannyContent") { 
					
					Tweener.addTween(dannyContent, { onComplete:function() {  this.alpha = 0; moveIn(page);}});
					
					
							}
											
					}
										
				}
				
				function moveIn (next:String) {
									
					if (next=="nikoleContent") {
						Tweener.addTween(nikoleContent, {x:330, time:0.6, transition:"easeOutSine"});
						Tweener.addTween(nikoleContent, {alpha:1, time:0.3, delay:0.3, transition:"easeOutSine"});
					}
					if (next=="sairaContent") {
						Tweener.addTween(sairaContent, {x:330, time:0.6, transition:"easeOutSine"});
						Tweener.addTween(sairaContent, {alpha:1, time:0.3, delay:0.3, transition:"easeOutSine"});
					}
					if (next=="nickContent") {
						Tweener.addTween(nickContent, {x:330, time:0.6, transition:"easeOutSine"});
						Tweener.addTween(nickContent, {alpha:1, time:0.3, delay:0.3, transition:"easeOutSine"});
					}
					
					if (next=="jamieContent") {
						Tweener.addTween(jamieContent, {x:330, time:0.6, transition:"easeOutSine"});
						Tweener.addTween(jamieContent, {alpha:1, time:0.3, delay:0.3, transition:"easeOutSine"});
					}
					
					if (next=="dannyContent") {
						Tweener.addTween(dannyContent, {x:330, time:0.6, transition:"easeOutSine"});
						Tweener.addTween(dannyContent, {alpha:1, time:0.3, delay:0.3, transition:"easeOutSine"});
					}
									
					
					currentPage=next;
									
									
			}
			
			public function backDesk(e): void {
				
					currentPage = "nikoleContent";
					
					stage.removeChild(merchDoor);
					merchDoor.removeEventListener(MouseEvent.CLICK, merchLoad);
				
					stage.removeChild(dannyContent);
					stage.removeChild(nikoleContent);
					stage.removeChild(nickContent);
					stage.removeChild(sairaContent);
					stage.removeChild(jamieContent);
					
					stage.removeChild(danny);
					stage.removeChild(nikole);
					stage.removeChild(nick);
					stage.removeChild(saira);
					stage.removeChild(jamie);
					
					
					
					
					
					
					leftArrow.removeEventListener(MouseEvent.CLICK, backDesk);
					leftArrow.addEventListener(MouseEvent.CLICK, moveLeft);
					
					//Blur studio
					desk.filters = [myBlurFilter];
					//Animate between backgrounds		
					Tweener.addTween(desk, {x:606.15, time:0.6, transition:"easeOutSine"});
					Tweener.addTween(desk, {_Blur_blurX: 0, _Blur_blurY: 0, _Blur_quality:2, time:0.6, delay:0.3, transition:"easeOutSine"});
					Tweener.addTween(studio, {x:1200, _Blur_blurX: 10, _Blur_blurY: 10, _Blur_quality:2, time:0.6, transition:"easeOutSine", onComplete: contentAdd});
					
					stage.addChild(rightArrow);
					rightArrow. x = 1161.3;
					rightArrow. y = 349.10;
					
					function contentAdd () {
					
					stage.addChild(deskInfo);
					deskInfo.x = 241.30;
					deskInfo.y = 74.20;
					deskInfo.filters = [myBlurFilter];
					Tweener.addTween (deskInfo, {_Blur_blurX: 0, _Blur_blurY: 0, _Blur_quality:2, time:0.8, transition:"easeOutSine"});
					Tweener.addTween (deskInfo, {x:190.30, time:0.8, transition:"easeOutSine"});
					
					
					}
				
				}
				
			
		
		}

}

Answer : access load swf outside of loader function

Random Solutions  
 
programming4us programming4us