This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Flash Site Design > May 2005 > Flash MX 2004





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Flash MX 2004
Darreb

2005-04-27, 7:20 pm

I've been programming a while, but I'm new to flash. I have MX 2004 and never
seen previous versions. I've read a couple of books (application development
from macromedia press and SAMs teach yourself in 21 days) so I feel comfortable
with the basics. I have really only one question, which concerns loading
external swf files into my main application. I am using the Forms based project
and I want to know what is the 'best' way to load external swf (this may be
anyone's opinion). I've seen examples built in previous versions of flash where
all the swf files are built with the same screen size and developers physically
place the content where they want so that when the swf load the placement is
where it is. I practiced doing it this way and it works fine. Maybe this is the
only way it should be done.

With a forms application I figured this wouldn't matter. So, what I've been
trying to do is build a swf (child) that is smaller than my Forms (parent) swf
and get it to load exactly where I want. I am using class files so none of my
swf actually has code in them. The following is some example code from my class
file that I'm trying to get to work. I want to load the content when the button
is pressed not when the form is loaded, which evidently is my problem.

private var data_mc:MovieClip; // DEFINED AT TOP OF CLASS

// IF PLACED ON FORM LOAD WORKS PERFECTLY
this.createEmptyMovieClip("data_mc", 10);
data_mc._x = 100;
data_mc._y = 200;
data_mc.loadMovie("dynaWin.swf")
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

// IF PLACED ON A BUTTON ON FORM DOESN'T APPEAR TO DO ANYTHING
// THIS IS WHAT I WANT TO DO! SO WHY DOESN'T THIS WORK ON A BUTTON?
this.createEmptyMovieClip("data_mc", 10);
data_mc._x = 100;
data_mc._y = 200;
data_mc.loadMovie("dynaWin.swf")
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

//~~ THIS CODE WORKS WITH A POPUP WINDOW ~~//
// I DON'T KNOW WHY THIS WORKS AND THE PREVIOUS CODE DOES NOT
// BUT I DON'T WANT TO USE A POPUP ANYWAY
this.createEmptyMovieClip("home_mc", 10);
var myTW:MovieClip =
PopUpManager.createPopUp(_root,Window,false,{closeButton:true, title:"Test",

_width:510, _height:335, contentPath:"dynaWin.swf"});
myTW._x = 100;
myTW._y = 200;
var twListener:Object = new Object();
twListener.click = function(evt:Object){evt.target.deletePopUp();}
myTW.addEventListener("click", twListener);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

I figure I'm trying to do something it's not supposed to do or I'm missing
something that's fairly simple and I can't see it. I've used the code out of
these books and the help files and I just can't get the effect I want. I can't
imagine this would be that difficult. I've also tried using a loader component
and can't get it to work unless AutoLoad is true. So, how can I do this? Can it
be done? Why does the code work on the OnLoad but not on the button OnClick?
Any help would be appreciated.

Darren


tool712

2005-05-03, 7:20 am

Hmm...I created a dynamic picture menu that places an external .swf innside a movie clip instance when called by a scrolling button menu. Here is the http://tool712.com


Darreb

2005-05-04, 7:20 pm

Tool,

thanks for the reply and I appreciate the help. I'm going to give this a try.
I don't know if it matters but I'm using a forms application (new to mx 2004)
project. It shouldn't matter but all the examples I've see have not used this.

Darren

Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews