Jump to content

Help on Flash CS3 AS2


Recommended Posts

I encountered a weird problem when I doing my AS2 programming in Flash.

When I publish the .swf movie, and play it, it returns

A script in this movie is causing Flash Player to run slowly. If it continues to run, your computer may become unresponsive. Do you want to abort the script?

 

And after I search and test, I found out the main problem would be this loop which caused the problem.

function readXML()

{

photoNumArray = [];

firstchild = photoxml.firstChild;

thumbpath = firstchild.attributes.thumbpath;

fullpath = firstchild.attributes.fullpath;

for (secondchild = firstchild.firstChild; secondchild != null || secondchild != undefined; secondchild.nextSibling)

{

photoArray = new Array();

photoArray[1] = secondchild.attributes.thumbname;

photoArray[2] = secondchild.attributes.fullname;

photoArray[3] = secondchild.attributes.desc;

photoNumArray.push(photoArray);

delete photoArray;

}

}

 

photoxml = new XML();

photoxml.ignoreWhite = true;

photoxml.load("photos.xml");

photoxml.onLoad = readXML;

 

The FOR LOOP is causing this lagness. And the XML contents is as follows.

<gallery thumbpath="images/thumbnail/" fullpath="images/fullsize/">

<image thumbname="t01.jpg" fullname="f01.jpg" desc="First picture"></image>

<image thumbname="t02.jpg" fullname="f02.jpg" desc="Second picture"></image>

<image thumbname="t03.jpg" fullname="f03.jpg" desc="Third picture"></image>

<image thumbname="t04.jpg" fullname="f04.jpg" desc="Fourth picture"></image>

<image thumbname="t05.jpg" fullname="f05.jpg" desc="Fifth picture"></image>

<image thumbname="t06.jpg" fullname="f06.jpg" desc="Sixth picture"></image>

</gallery>

 

The weird thing is, I used the exactly same FOR LOOP in my another .swf movie, it returns no error.

But in this case, just the XML sheet is 2 lines longer than the working one, and the FOR LOOP creates 1 more array for each loop.

And it returns such error.

 

Anyone can help me? Thanks.

 

Earnest,

JcX

Link to comment
Share on other sites

EDIT

Problems solved, by just simply rewrite the whole scripts and modify a little bit which I don't think will affect the loop

 

New problems:

I use another loop to help me create a few movieclips on the stage, and loads the picture URL from XML.

function loadPhoto()

{

for (p=0; p<=5; p++)

{

thumblist_mc = _root.photolist_mc.createEmptyMovieClip("thumb"+p, p);

thumblist_mc._y = 100 * p;

thumblist_mc.loadMovie(thumbpath + photoNumArray[p][1]);

 

thumb0.onRelease = function()

{

preview_mc.loadMovie(fullpath + photoNumArray[p-1][2]);

}

}

}

 

The problem is this part

thumb0.onRelease = function()

{

preview_mc.loadMovie(fullpath + photoNumArray[p-1][2]);

}

 

Can't I use onRelease function for movieclips I created by createEmptyMovieClip() function?

And if I use FOR LOOP to create movieclips, how can I set different loadMovie("URL") for each movieclips I've created?

Please help.... Million thanks to all.

Link to comment
Share on other sites

Hi very nice to meet you.

I'm just an undergraduate engineer who obsessed with multimedia design, especially Flash.

I couldn't find any tutor who willing to teach me for FREE, so I learn it all by myself. ^^

Maybe we can exchange our experience sometimes though.

 

Again... It's my honour to meet you Karthi.

Link to comment
Share on other sites

Nope, I from Malaysia, just few steps below you. :-p

 

Hmmmm.. Flash aren't so welcome just because of it size and loading speed.

but after AS 3.0, I believe the speed had immensely increased and that should be a problem though.

Although VB.Net, Java are very well accepted, but still I insisted to use Flash as my main web presentation.

Link to comment
Share on other sites

Flash has its own incomparable uniqueness - attracting animation + interesting interaction with browsers.

The reason I like Flash is because it can makes me outstand from the crowd.

All my friends like my site because I'm based on Flash while they're based on blog.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...