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




Preloader Returns Infinity



It's very weird. The code works fine when test in Flash, but doesnt work when upload to web hosting. var imageListener:Object = new Object(); imageListener.onLoadProgress = function(target_mc:MovieClip, loadedBytes:Number, totalBytes:Number){target_mc.loading_mc.loading_txt._visible = true;target_mc.loading_mc.loading_txt.text = this+" : "+Math.floor((loadedBytes/totalBytes)*100);}; imageListener.onLoadInit = function(target_mc:MovieClip){target_mc._parent._parent.loading_mc.loading_txt.t ext = "";}; imageListener.onLoadComplete = function(target_mc:MovieClip){target_mc._parent._parent.loading_mc.loading_txt.t ext = ""; var rMoveX = new Tween(target_mc, "_x", Regular.easeInOut, target_mc , (enl_xl-target_mc._width), 2, true); };var myLoader:MovieClipLoader = new MovieClipLoader(); ===========================http://www.yujai.com/index64.htmlPlease click "painting" and then click on the thumbnail=========================== Please help!Thanks in advancE!



KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 03-26-2006, 10:01 PM


View Complete Forum Thread with Replies

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

Infinity With Preloader
I noticed something strange !!!
When I view my site on a computer with flash version 8.0.24 the preloader works perfect. the percentage is shown from 0 too 100%. But when I go to a computer with flash version 8.0.34 or higher(v9) I get infinity%?
Isn't this strange?

this is the code in frame 1:

function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
dimensionX = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image = xmlNode.childNodes.childNodes[0].firstChild.nodeValue;
description = xmlNode.childNodes.childNodes[1].firstChild.nodeValue;
dimensionX = xmlNode.childNodes.childNodes[2].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("portfolio-landscapes.xml");
/////////////////////////////////////
p = 0;
/////////////////////////////////////

/////////////////////////////////////
/*this.onEnterFrame = function() {
filesize = imageholder.mcimage.getBytesTotal();
loaded = imageholder.mcimage.getBytesLoaded();
percentage = Math.floor((loaded/filesize)*100);
preloader._visible = true;
if (loaded != filesize) {
preloader.progressbar._xscale = percentage;
// set the percentage dynamic textfield
preloader.progresstxt.perc.text = percentage+"%";
}
else if (loaded == filesize){
preloader._visible = false;
// done loading image so now we can resize.
// centerpoint of the movieclip "mcimage" to be set as you wish.
mcimageX = 380;
mcimageY = 245;
// now we get the size of the image
imgwidth = imageholder.mcimage._width;
imgheight = imageholder.mcimage._height;
// finally, set new _x and _y position to center the image to the centerpoint
imageholder.mcimage._x = mcimageX-(imgwidth/2);
imageholder.mcimage._y = mcimageY-(imgheight/2);
if (_root.win._width == _root.w && imageholder._alpha<100) {
imageholder._alpha += 10;
}
}
};*/
//////////////////////////////////////////
function nextImage() {
if (p<(total-1)) {
p++;
// 160 = 145 menubalk + 5 kader links + 2x witrand rondom de foto's
_root.w = Number(dimensionX[p])+160;
imageholder._alpha = 0;
imageholder.mcimage.loadMovie(image[p], 1);
mcinfo.desc_txt.text = description[p];
picture_num();
preloadthing();
}
}
function prevImage() {
if (p>0) {
p--;
_root.w = Number(dimensionX[p])+160;
imageholder._alpha = 0;
imageholder.mcimage.loadMovie(image[p], 1);
mcinfo.desc_txt.text = description[p];
picture_num();
preloadthing();
}
}
function firstImage() {
imageholder.mcimage.loadMovie(image[0], 1);
mcinfo.desc_txt.text = description[0];
_root.w = Number(dimensionX[0])+160;
imageholder._alpha = 0;
picture_num();
preloadthing();
}
function picture_num() {
current_pos = p+1;
mcinfo.pos_txt.text = current_pos+"/"+total;
}
/////////////////////////////
function preloadthing() {
this.onEnterFrame = function() {
filesize = imageholder.mcimage.getBytesTotal();
loaded = imageholder.mcimage.getBytesLoaded();
percentage = Math.floor((loaded/filesize)*100);
preloader._visible = true;
if (loaded != filesize && loaded > 0) {
preloader.progressbar._xscale = percentage;
// set the percentage dynamic textfield
preloader.progresstxt.perc.text = percentage+"%";
}
else if (loaded == filesize && filesize > 0){
preloader._visible = false;
// done loading image so now we can resize.
// centerpoint of the movieclip "mcimage" to be set as you wish.
mcimageX = 380;
mcimageY = 245;
// now we get the size of the image
imgwidth = imageholder.mcimage._width;
imgheight = imageholder.mcimage._height;
// finally, set new _x and _y position to center the image to the centerpoint
imageholder.mcimage._x = mcimageX-(imgwidth/2);
imageholder.mcimage._y = mcimageY-(imgheight/2);
if (_root.win._width == _root.w && imageholder._alpha<100) {
imageholder._alpha += 10;
}
}
}
}

WHAT AM I DOING WRONG ????
Thanks,
Max.





























Edited: 12/31/2006 at 03:13:32 AM by maxdido

XML Preloader Infinity Problem
I'm building a flash app which imports an XML file generated by an SQL database and manipulated by a PHP script. I have a XML preloader class that I typically use for my XML...it calculates the total size of the file and creates a preload bar (and percentage loaded) accordingly however, it seems to have problems determining XML file size since the XML file is generated each time via PHP. So...when I run the XML file (generated from SQL and PHP) through my XML preload class, it has trouble calculating the total file size and throws off my loader bar. Has anyone ever run into this? Is there any way to get something like this to work where it can calculate the file size when the XML is streaming?

Any help would be greatly appreciated. Thanks!

External Preloader(JPG): "Loading Infinity Of 0K"
Hey there,
I am trying to preload an external image (jpg) and I just get the message "Loading Infinity of 0K" -(zero K)- where the word infinity and the number "zero" come from
code: var percentLoaded = Math.ceil((this.getBytesLoaded()/this.getBytesTotal()) * 100);

var kilobytes = Math.ceil(this.getBytesTotal()/1024);

it seems that is does not work on jpegs but it does on preloading swfs.

Does anyone know about this, please comment

Cërf

Preloader Demon Returns
We have client that insists his *12mb* live person transparent flv is able to be viewed over a 56k dial up connection.

When we do a standard preloader [ifFramesloaded] the flv audio is off sync. We tried increasing buffer time, using different players, and even the setBufferTime code to no avail.

Any help would be appreciated. I have searched through 12 google pages, and read every single preloader post in this forum and could not find an answer...

Infinity Problem
Hi guys,

Got a slight problem. I'm trying to multiply a variable by either 1 or 0 depending on the content of another variable.

This is the code I've used:

TotalTime = (_root.PagesMain * PunchRate * (_root.FoldersMain /_root.FoldersMain));

This works if the value of FoldersMain is greater than Zero, but if 0 the result is NaN as anything divided by zero is infinity. Is there a way of forcing the result to be 0 instead of NaN?

Cheers,

O.

Duplicate Infinity
Hi all
I need help! I am trying to create a drag and drop game.

I have movieclip instace "clipA" inside clipA has a transparent button with and following script to it.

on (press) {
duplicateMovieClip(this, "man", 9999);
startDrag(_parent.man, true);
drag = true;
}

on (release) {
stopDrag();
drag = false;
}

but it lets me only duplicate once...how do I duplicate x number of time plus how do I attach linked mc from libary to every duplicated movie.

the linked linked mc is a component
http://www.flashcomponents.net/compo...iew.php?id=185

many thanks for you help
reverse

Why Me Getting Infinity When Using GetBytesLoaded?
Hi,
I have a fairly complex MX site that dynamically loads images and content. On one of my pc's everything loads great. On the other PC when pre-loading images or data the getBytesLoaded is showing as 'Infinity' Does anyone know why. Both have the latest plugin version and run XP. See for yourself possibly.

http://www.whomwah.com/MX_whomwah/index.html

than click on NEWS.

Here's the code I use
Code:
//create the pre_loader
blabla.attachMovie("preStuff_small", "preStuff_small", 999999);
//create and image holder
blabla.createEmptyMovieClip("image", 1);
//load the image
blabla.image.loadMovie("aPrettyPicture.jpg");
blabla.onEnterFrame = function() {
var short = this.image;
var percent = Math.round((short.getBytesLoaded()/short.getBytesTotal())*100);
if (!isNaN(percent)) {
var theLot = Math.round(short.getBytesTotal()/1000);
this.preStuff_small.preload_mc.text = percent+"% Loaded of ("+theLot+"k)";
} else {
this.preStuff_small.preload_mc.text = "0% Loaded of ("+theLot+"k)";
}
if (percent == 100) {
//stop the on enter frame
delete this.onEnterFrame;
//remove the pre-loader
blabla.preStuff_small.removeMovieClip();
}
}

Can I Round Infinity
I have an equation that will very often yield an infinite number so I need an interim step to cut the number off at around four decimal places. Does any one know a way to achieve this?

It would seem there should be a way to do this otherwise Flash’s usefulness with math would be seriously crippled but I haven’t been able to find anything in any of the resources I have.

Getting (NAN, Or INFINITY) In My Dynamic Boxes
I have a chart that I'm creating and in the dynamic text boxes, I have it as a multiline so I can get more than one answer for my calculations. My problem is when ever an answer is given, I get NAN, or INFINITY and then in one of the appropriate feilds I get the correct calculations.
ex..
box(1) box(2) box(3) box(4)
NAN INFINITY 65 36
NAN NAN NAN NAN
INFINITY NAN NAN NAN

Is there a way to have it so that I wont get any text in my boxes other that the correct calculations that are ment to be.

thanx

ANY SUGGESTIONS WILL BE APPRECIATED!

Kirupa Infinity Menu Help
i have a kirupa infinty menu as its own swf loaded into another larger movie. the thing im trying to fix is:

when the mouse leaves the menu is keeps moving it up and down when navigating the rest of the site...is there a way to stop the mouse interacting with the menu if the mouse isnt ontop of it...

like onrollout stop moving the menu?

any help would be much appreciated

Movement In A Figure 8 / Infinity
Hi

I'm trying to write a script that will move a mc in a figure 8, kinda like the way that water flows from side to side inside a container... flowing in one direction and rising, then hitting the wall and ebbing as it flows back the other way... slowing down over time

To say that I'm not that mathematically inclined is an understatement, but i think it can be done using trigonometry, like sin and cos...??

I found this page on here - http://www.kirupa.com/developer/mx/circular.htm - this is similar to what i want to do, except when the clip passes the center to move away in a figure eight and then back, instead of just going around in a circle. And i think i want the mc to come to rest in the middle over time, so the figure eight is gradually reducing in size.

There's also a method that looks like it could be adapted to do what i want using elasticity - http://www.kirupa.com/developer/actionscript/spring.htm , bottom example.

Hopefully this is not too confusing.. i've put up a page on my site with a bit of a visual representation of what i want it to do:

http://www.fracture.co.nz/help

Thanks in adavance for your help!!

Fracture

Infinity Menu **** Image Help :(
Dear whomever can help me figure this out,

I am trying to create a new website in flash to showcase my illustration and design. I was hoping to use the infinite menu.

I would like to have all my illustration in one scrolling menu, and one set of design in another using the same effect like the infinite menu.

If I have all the illustrations grouped in one image how could i get it to scroll and repeat based on the mouse movement such as the infinite menu.

Any input would help. please feel free to check out my website. www.patrickbrickman.com Thanks

Movement In A Figure 8 / Infinity
Hi

I'm trying to write a script that will move a mc in a figure 8, kinda like the way that water flows from side to side inside a container... flowing in one direction and rising, then hitting the wall and ebbing as it flows back the other way... slowing down over time

To say that I'm not that mathematically inclined is an understatement, but i think it can be done using trigonometry, like sin and cos...??

I found this page on here - http://www.kirupa.com/developer/mx/circular.htm - this is similar to what i want to do, except when the clip passes the center to move away in a figure eight and then back, instead of just going around in a circle. And i think i want the mc to come to rest in the middle over time, so the figure eight is gradually reducing in size.

There's also a method that looks like it could be adapted to do what i want using elasticity - http://www.kirupa.com/developer/actionscript/spring.htm , bottom example.

Hopefully this is not too confusing.. i've put up a page on my site with a bit of a visual representation of what i want it to do:

http://www.fracture.co.nz/help

Thanks in adavance for your help!!

Fracture

Infinity Menu **** Image Help :(
Dear whomever can help me figure this out,

I am trying to create a new website in flash to showcase my illustration and design. I was hoping to use the infinite menu.

I would like to have all my illustration in one scrolling menu, and one set of design in another using the same effect like the infinite menu.

If I have all the illustrations grouped in one image how could i get it to scroll and repeat based on the mouse movement such as the infinite menu.

Any input would help. please feel free to check out my website. www.patrickbrickman.com Thanks

Infinity Menu With Easing Stop
Ok so I have a menu that I made from a couple of sources but I cant get it to stop moving on rollout. Basicaly its a infinite horizontal menu with a tsunami effect. On roll out I would like it to ease to a stop but i cant figuer that out.

a good example of what I would like it to do can be found here

http://www.ascentium.com/ like how there buttons follow eachother on the x axis. (how do they do that?)

But my horible mess can be found here (attached below)


Any responce is welcome My thanks in advance.

Infinity Menu With Easing Stop (cs3,AS2)
Ok so I have a menu that I made from a couple of sources but I cant get it to stop moving on rollout. Basicaly its a infinite horizontal menu with a tsunami effect. On roll out I would like it to ease to a stop but i cant figuer that out.

a good example of what I would like it to do can be found here

http://www.ascentium.com/ like how there buttons follow eachother on the x axis. (how do they do that?)

But my horible mess can be found here (attached below)


Any responce is welcome My thanks in advance.

Infinity Instead Of Numbers In Loaded Percentage Field
Hi,
I have a wierd preloader error which is only noticable in IE browsers on Windows systems.

Here is the link:
http://www.attila.reinhardt.com/clients/accentcom/preview/preview.html

The linking of the "cheyney university" images for dynamic loading inside the "work" section are handled by an xml file and the attached script.
Each of the displayed images are around 150kb-300kb png files with alpha transparency.
I have a percentage loaded field which returns "infinity" when viewed in IE and the percentage amount is not displayed however the image loads in.

The error does not appear in Firefox and Netscape on Windows and I have also tested the page in Safari on the Mac and it was ok the numbers are nicely running as the images load in.

Why is this happening in IE and what can be the solution?
Thank you for your feedback in advance,
Attila










Attach Code

//importing transitions and filters:
import mx.transitions.*;
import mx.transitions.easing.*;
import flash.filters.*;
//
percentFieldMC._visible = false;
//

//initializing XML
myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(ok) {
//if XML Loaded then call in first pic and populate fields:
if (ok) {
//setting red style text:
//captionField.htmlText = storyText;
//load css
//setting section name based on xml data:
//section_txt.text = myXML.idMap['section'].firstChild.firstChild;
//section_txt2.text = myXML.idMap['title'].firstChild.firstChild;

btn1on.gotoAndStop(2);
//setting xml id for first image:
itemID = 'brief';
//setting first caption based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.firstChild;
//setting first pic url based on xml data:
//imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
//startLoading();
//setting percentage field visibility:
//infoField._visible = true;
//button functions:
btn1.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
removeMovieClips();
btn1on.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = false;
//setting xml id for selected button content:
itemID = 'brief';
briefMC.gotoAndPlay(1);
captionField.text = myXML.idMap[itemID].firstChild.firstChild;
//setting captions based on xml data:
//captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
//imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
//startLoading();
//setting buttons visited state:
};
btn2.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
removeMovieClips();
briefMC.gotoAndStop(20);
btn1on.gotoAndStop(1);
btn2on.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = true;
//setting xml id for selected button content:
itemID = '01';
//setting captions based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
startLoading();
//setting buttons visited state:
};
btn3.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
briefMC.gotoAndStop(20);
removeMovieClips();
menuC_additAnnAppMC.gotoAndStop(2);
btn3on.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = true;
//setting xml id for selected button content:
itemID = '02';
//setting captions based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
startLoading();
//setting buttons visited state:
};
btn4.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
briefMC.gotoAndStop(20);
removeMovieClips();
menuC_additCaseStatMC.gotoAndStop(2);
btn4on.gotoAndStop(2);
menu_casestatPagesMC.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = true;
//setting xml id for selected button content:
itemID = '03a';
//setting captions based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
startLoading();
//setting buttons visited state:
};
btn5.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
briefMC.gotoAndStop(20);
removeMovieClips();
menuC_additNewslettersMC.gotoAndStop(2);
btn5on.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = true;
//setting xml id for selected button content:
itemID = '04';
//setting captions based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
startLoading();
//setting buttons visited state:
};
btn6.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
briefMC.gotoAndStop(20);
removeMovieClips();
menuC_additPlanGivingMC.gotoAndStop(2);
btn6on.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = true;
//setting xml id for selected button content:
itemID = '05';
//setting captions based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
startLoading();
//setting buttons visited state:
};
btn7.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
briefMC.gotoAndStop(20);
removeMovieClips();
menuC_additAnnReportMC.gotoAndStop(2);
btn7on.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = true;
//setting xml id for selected button content:
itemID = '06';
//setting captions based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
startLoading();
//setting buttons visited state:
};
} else {
//XML loading error:
trace('what file?');
}
};
//XML loading:
myXML.load('cheyney_idMapped.xml');
//remove clips:
_global.removeMovieClips = function() {
removeMovieClip(mc);
//menuC_additCaseStatMC.gotoAndStop(1);
menu_casestatPagesMC.gotoAndStop(1);
//menu_casestatPagesMC.gotoAndStop(1);
menuC_additAnnAppMC.gotoAndStop(1);
menuC_additAnnReportMC.gotoAndStop(1);
menuC_additCaseStatMC.gotoAndStop(1);
menuC_additNewslettersMC.gotoAndStop(1);
menuC_additPlanGivingMC.gotoAndStop(1);
btn1on.gotoAndStop(1);
btn2on.gotoAndStop(1);
btn3on.gotoAndStop(1);
btn4on.gotoAndStop(1);
btn5on.gotoAndStop(1);
btn6on.gotoAndStop(1);
btn7on.gotoAndStop(1);
};
//loading pictures:
function startLoading() {
//creating listener object
var loadListener:Object = new Object();
//pic holder clip loading and ongoing percentage monitoring:
loadListener.onLoadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
//placing percentage value in percentage field:
numPercentLoaded = Math.round(bytesLoaded/bytesTotal*100);
//percentFieldMC.infoField.text = "[ Loading image: "+numPercentLoaded+"% ]";
percentFieldMC.infoField.text = numPercentLoaded+" %";
//trace(percentFieldMC.infoField.text);
};
//pic holder clip loaded and ready for display setting initial parameters:
loadListener.onLoadComplete = function(target_mc:MovieClip, httpStatus:Number):Void {
//setting the visibility of pic holder clip
mc._visible = false;
};
//first frame events for pic holder clip and related items:
loadListener.onLoadInit = function(target_mc:MovieClip):Void {
//when on the first frame, setting the first button to visited state:
//if (itemID == '01') {
//btn1on.gotoAndStop(2);
//}
//setting the visibility of pic holder clip:
mc._visible = true;
//setting percentage monitoring field visibility:
percentFieldMC._visible = false;
//setting up transition effects for pic holder clip:
TransitionManager.start(mc, {type:Fade, direction:Transition.IN, duration:0.5, easing:None.easeNone});
var mcBlur:Tween = new Tween(mc, "blurX", Strong.easeIn, 64, 0, 15, false);
mcBlur.onMotionChanged = function() {
mc.filters = [new BlurFilter(mc.blurX, 1)];
};
};
//assigning movieclip loader object:
var mcLoader:MovieClipLoader = new MovieClipLoader();
//assigning listener object:
mcLoader.addListener(loadListener);
//creating empty pic holder clip:
var mc:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
mc._x = 450;
mc._y = 65;
//loading xml acquired url data into pic holder clip:
mcLoader.loadClip(imageLink.nodeValue, mc);
}
//remove main button indicators for additional indicators
_global.removeMainIndicators = function() {
menu_casestatPagesMC.gotoAndStop(1);
btn1on.gotoAndStop(1);
btn2on.gotoAndStop(1);
btn3on.gotoAndStop(1);
btn4on.gotoAndStop(1);
btn5on.gotoAndStop(1);
btn6on.gotoAndStop(1);
btn7on.gotoAndStop(1);
};
//stop on frame:
stop();

Infinity Instead Of Numbers In Loaded Percentage Field
Hi,
I have a wierd preloader error which is only noticable in IE browsers on Windows systems.

Here is the link:
http://www.attila.reinhardt.com/clients/accentcom/preview/preview.html

The linking of the "cheyney university" images for dynamic loading inside the "work" section are handled by an xml file and the attached script.
Each of the displayed images are around 150kb-300kb png files with alpha transparency.
I have a percentage loaded field which returns "infinity" when viewed in IE and the percentage amount is not displayed however the image loads in.

The error does not appear in Firefox and Netscape on Windows and I have also tested the page in Safari on the Mac and it was ok the numbers are nicely running as the images load in.

Why is this happening in IE and what can be the solution?
Thank you for your feedback in advance,
Attila









Attach Code

//importing transitions and filters:
import mx.transitions.*;
import mx.transitions.easing.*;
import flash.filters.*;
//
percentFieldMC._visible = false;
//

//initializing XML
myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(ok) {
//if XML Loaded then call in first pic and populate fields:
if (ok) {
//setting red style text:
//captionField.htmlText = storyText;
//load css
//setting section name based on xml data:
//section_txt.text = myXML.idMap['section'].firstChild.firstChild;
//section_txt2.text = myXML.idMap['title'].firstChild.firstChild;

btn1on.gotoAndStop(2);
//setting xml id for first image:
itemID = 'brief';
//setting first caption based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.firstChild;
//setting first pic url based on xml data:
//imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
//startLoading();
//setting percentage field visibility:
//infoField._visible = true;
//button functions:
btn1.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
removeMovieClips();
btn1on.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = false;
//setting xml id for selected button content:
itemID = 'brief';
briefMC.gotoAndPlay(1);
captionField.text = myXML.idMap[itemID].firstChild.firstChild;
//setting captions based on xml data:
//captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
//imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
//startLoading();
//setting buttons visited state:
};
btn2.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
removeMovieClips();
briefMC.gotoAndStop(20);
btn1on.gotoAndStop(1);
btn2on.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = true;
//setting xml id for selected button content:
itemID = '01';
//setting captions based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
startLoading();
//setting buttons visited state:
};
btn3.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
briefMC.gotoAndStop(20);
removeMovieClips();
menuC_additAnnAppMC.gotoAndStop(2);
btn3on.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = true;
//setting xml id for selected button content:
itemID = '02';
//setting captions based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
startLoading();
//setting buttons visited state:
};
btn4.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
briefMC.gotoAndStop(20);
removeMovieClips();
menuC_additCaseStatMC.gotoAndStop(2);
btn4on.gotoAndStop(2);
menu_casestatPagesMC.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = true;
//setting xml id for selected button content:
itemID = '03a';
//setting captions based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
startLoading();
//setting buttons visited state:
};
btn5.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
briefMC.gotoAndStop(20);
removeMovieClips();
menuC_additNewslettersMC.gotoAndStop(2);
btn5on.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = true;
//setting xml id for selected button content:
itemID = '04';
//setting captions based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
startLoading();
//setting buttons visited state:
};
btn6.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
briefMC.gotoAndStop(20);
removeMovieClips();
menuC_additPlanGivingMC.gotoAndStop(2);
btn6on.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = true;
//setting xml id for selected button content:
itemID = '05';
//setting captions based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
startLoading();
//setting buttons visited state:
};
btn7.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
briefMC.gotoAndStop(20);
removeMovieClips();
menuC_additAnnReportMC.gotoAndStop(2);
btn7on.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = true;
//setting xml id for selected button content:
itemID = '06';
//setting captions based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
startLoading();
//setting buttons visited state:
};
} else {
//XML loading error:
trace('what file?');
}
};
//XML loading:
myXML.load('cheyney_idMapped.xml');
//remove clips:
_global.removeMovieClips = function() {
removeMovieClip(mc);
//menuC_additCaseStatMC.gotoAndStop(1);
menu_casestatPagesMC.gotoAndStop(1);
//menu_casestatPagesMC.gotoAndStop(1);
menuC_additAnnAppMC.gotoAndStop(1);
menuC_additAnnReportMC.gotoAndStop(1);
menuC_additCaseStatMC.gotoAndStop(1);
menuC_additNewslettersMC.gotoAndStop(1);
menuC_additPlanGivingMC.gotoAndStop(1);
btn1on.gotoAndStop(1);
btn2on.gotoAndStop(1);
btn3on.gotoAndStop(1);
btn4on.gotoAndStop(1);
btn5on.gotoAndStop(1);
btn6on.gotoAndStop(1);
btn7on.gotoAndStop(1);
};
//loading pictures:
function startLoading() {
//creating listener object
var loadListener:Object = new Object();
//pic holder clip loading and ongoing percentage monitoring:
loadListener.onLoadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
//placing percentage value in percentage field:
numPercentLoaded = Math.round(bytesLoaded/bytesTotal*100);
//percentFieldMC.infoField.text = "[ Loading image: "+numPercentLoaded+"% ]";
percentFieldMC.infoField.text = numPercentLoaded+" %";
//trace(percentFieldMC.infoField.text);
};
//pic holder clip loaded and ready for display setting initial parameters:
loadListener.onLoadComplete = function(target_mc:MovieClip, httpStatus:Number):Void {
//setting the visibility of pic holder clip
mc._visible = false;
};
//first frame events for pic holder clip and related items:
loadListener.onLoadInit = function(target_mc:MovieClip):Void {
//when on the first frame, setting the first button to visited state:
//if (itemID == '01') {
//btn1on.gotoAndStop(2);
//}
//setting the visibility of pic holder clip:
mc._visible = true;
//setting percentage monitoring field visibility:
percentFieldMC._visible = false;
//setting up transition effects for pic holder clip:
TransitionManager.start(mc, {type:Fade, direction:Transition.IN, duration:0.5, easing:None.easeNone});
var mcBlur:Tween = new Tween(mc, "blurX", Strong.easeIn, 64, 0, 15, false);
mcBlur.onMotionChanged = function() {
mc.filters = [new BlurFilter(mc.blurX, 1)];
};
};
//assigning movieclip loader object:
var mcLoader:MovieClipLoader = new MovieClipLoader();
//assigning listener object:
mcLoader.addListener(loadListener);
//creating empty pic holder clip:
var mc:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
mc._x = 450;
mc._y = 65;
//loading xml acquired url data into pic holder clip:
mcLoader.loadClip(imageLink.nodeValue, mc);
}
//remove main button indicators for additional indicators
_global.removeMainIndicators = function() {
menu_casestatPagesMC.gotoAndStop(1);
btn1on.gotoAndStop(1);
btn2on.gotoAndStop(1);
btn3on.gotoAndStop(1);
btn4on.gotoAndStop(1);
btn5on.gotoAndStop(1);
btn6on.gotoAndStop(1);
btn7on.gotoAndStop(1);
};
//stop on frame:
stop();

Infinity Instead Of Numbers In Loaded Percentage Field
Hi,
I have a wierd preloader error which is only noticable in IE browsers on Windows systems.

Here is the link:
http://www.attila.reinhardt.com/clients/accentcom/preview/preview.html

The linking of the "cheyney university" images for dynamic loading inside the "work" section are handled by an xml file and the attached script.
Each of the displayed images are around 150kb-300kb png files with alpha transparency.
I have a percentage loaded field which returns "infinity" when viewed in IE and the percentage amount is not displayed however the image loads in.

The error does not appear in Firefox and Netscape on Windows and I have also tested the page in Safari on the Mac and it was ok the numbers are nicely running as the images load in.

Why is this happening in IE and what can be the solution?
Thank you for your feedback in advance,
Attila









Attach Code

//importing transitions and filters:
import mx.transitions.*;
import mx.transitions.easing.*;
import flash.filters.*;
//
percentFieldMC._visible = false;
//

//initializing XML
myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(ok) {
//if XML Loaded then call in first pic and populate fields:
if (ok) {
//setting red style text:
//captionField.htmlText = storyText;
//load css
//setting section name based on xml data:
//section_txt.text = myXML.idMap['section'].firstChild.firstChild;
//section_txt2.text = myXML.idMap['title'].firstChild.firstChild;

btn1on.gotoAndStop(2);
//setting xml id for first image:
itemID = 'brief';
//setting first caption based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.firstChild;
//setting first pic url based on xml data:
//imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
//startLoading();
//setting percentage field visibility:
//infoField._visible = true;
//button functions:
btn1.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
removeMovieClips();
btn1on.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = false;
//setting xml id for selected button content:
itemID = 'brief';
briefMC.gotoAndPlay(1);
captionField.text = myXML.idMap[itemID].firstChild.firstChild;
//setting captions based on xml data:
//captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
//imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
//startLoading();
//setting buttons visited state:
};
btn2.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
removeMovieClips();
briefMC.gotoAndStop(20);
btn1on.gotoAndStop(1);
btn2on.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = true;
//setting xml id for selected button content:
itemID = '01';
//setting captions based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
startLoading();
//setting buttons visited state:
};
btn3.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
briefMC.gotoAndStop(20);
removeMovieClips();
menuC_additAnnAppMC.gotoAndStop(2);
btn3on.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = true;
//setting xml id for selected button content:
itemID = '02';
//setting captions based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
startLoading();
//setting buttons visited state:
};
btn4.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
briefMC.gotoAndStop(20);
removeMovieClips();
menuC_additCaseStatMC.gotoAndStop(2);
btn4on.gotoAndStop(2);
menu_casestatPagesMC.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = true;
//setting xml id for selected button content:
itemID = '03a';
//setting captions based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
startLoading();
//setting buttons visited state:
};
btn5.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
briefMC.gotoAndStop(20);
removeMovieClips();
menuC_additNewslettersMC.gotoAndStop(2);
btn5on.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = true;
//setting xml id for selected button content:
itemID = '04';
//setting captions based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
startLoading();
//setting buttons visited state:
};
btn6.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
briefMC.gotoAndStop(20);
removeMovieClips();
menuC_additPlanGivingMC.gotoAndStop(2);
btn6on.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = true;
//setting xml id for selected button content:
itemID = '05';
//setting captions based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
startLoading();
//setting buttons visited state:
};
btn7.onRelease = function() {
//removing mc clip so transitions will play when it is loaded again:
briefMC.gotoAndStop(20);
removeMovieClips();
menuC_additAnnReportMC.gotoAndStop(2);
btn7on.gotoAndStop(2);
//setting percentage field visibility:
percentFieldMC._visible = true;
//setting xml id for selected button content:
itemID = '06';
//setting captions based on xml data:
captionField.text = myXML.idMap[itemID].firstChild.nextSibling.firstChild;
//setting pic url based on xml data:
imageLink = myXML.idMap[itemID].firstChild.nextSibling.nextSibling.firstChild;
//loading pic on stage with effects and monitoring:
startLoading();
//setting buttons visited state:
};
} else {
//XML loading error:
trace('what file?');
}
};
//XML loading:
myXML.load('cheyney_idMapped.xml');
//remove clips:
_global.removeMovieClips = function() {
removeMovieClip(mc);
//menuC_additCaseStatMC.gotoAndStop(1);
menu_casestatPagesMC.gotoAndStop(1);
//menu_casestatPagesMC.gotoAndStop(1);
menuC_additAnnAppMC.gotoAndStop(1);
menuC_additAnnReportMC.gotoAndStop(1);
menuC_additCaseStatMC.gotoAndStop(1);
menuC_additNewslettersMC.gotoAndStop(1);
menuC_additPlanGivingMC.gotoAndStop(1);
btn1on.gotoAndStop(1);
btn2on.gotoAndStop(1);
btn3on.gotoAndStop(1);
btn4on.gotoAndStop(1);
btn5on.gotoAndStop(1);
btn6on.gotoAndStop(1);
btn7on.gotoAndStop(1);
};
//loading pictures:
function startLoading() {
//creating listener object
var loadListener:Object = new Object();
//pic holder clip loading and ongoing percentage monitoring:
loadListener.onLoadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
//placing percentage value in percentage field:
numPercentLoaded = Math.round(bytesLoaded/bytesTotal*100);
//percentFieldMC.infoField.text = "[ Loading image: "+numPercentLoaded+"% ]";
percentFieldMC.infoField.text = numPercentLoaded+" %";
//trace(percentFieldMC.infoField.text);
};
//pic holder clip loaded and ready for display setting initial parameters:
loadListener.onLoadComplete = function(target_mc:MovieClip, httpStatus:Number):Void {
//setting the visibility of pic holder clip
mc._visible = false;
};
//first frame events for pic holder clip and related items:
loadListener.onLoadInit = function(target_mc:MovieClip):Void {
//when on the first frame, setting the first button to visited state:
//if (itemID == '01') {
//btn1on.gotoAndStop(2);
//}
//setting the visibility of pic holder clip:
mc._visible = true;
//setting percentage monitoring field visibility:
percentFieldMC._visible = false;
//setting up transition effects for pic holder clip:
TransitionManager.start(mc, {type:Fade, direction:Transition.IN, duration:0.5, easing:None.easeNone});
var mcBlur:Tween = new Tween(mc, "blurX", Strong.easeIn, 64, 0, 15, false);
mcBlur.onMotionChanged = function() {
mc.filters = [new BlurFilter(mc.blurX, 1)];
};
};
//assigning movieclip loader object:
var mcLoader:MovieClipLoader = new MovieClipLoader();
//assigning listener object:
mcLoader.addListener(loadListener);
//creating empty pic holder clip:
var mc:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
mc._x = 450;
mc._y = 65;
//loading xml acquired url data into pic holder clip:
mcLoader.loadClip(imageLink.nodeValue, mc);
}
//remove main button indicators for additional indicators
_global.removeMainIndicators = function() {
menu_casestatPagesMC.gotoAndStop(1);
btn1on.gotoAndStop(1);
btn2on.gotoAndStop(1);
btn3on.gotoAndStop(1);
btn4on.gotoAndStop(1);
btn5on.gotoAndStop(1);
btn6on.gotoAndStop(1);
btn7on.gotoAndStop(1);
};
//stop on frame:
stop();

Sending Text With "RETURNS" Through A Button To A Dynamic Textfields With "RETURNS"
I have a dynamic textfield which I am loading text into through a button. Here is the button code

on (press) {
_root.about = "this is my text that is loaded into a dynamic text field named about";
}

I'm trying to make returns appear in the dynamic textfield


HERE is what I would like the text to look like in the dynamic textfield


this is my text
that is loaded into a
dynamic textfield named about




I tried using /n in the button script but nothing appeared.

n (press) {
_root.about = "this is my text /n
that is loaded into a /n
dynamic text field named about";
}

Very Strange "Infinity"...
Hy, guys!

I´m having a very difficult problem:

There are two swf that can not get the "totalBytes" of a jpeg file using loadClip class...

My code:


Quote:




//criando um movie clip loader...
var fotosMCL:MovieClipLoader = new MovieClipLoader();
loaderFotos = new Object();
fotosMCL.addListener(loaderFotos);
//---------<codes para trigger>----------------\
// Iniciada a leitura dos dados
loaderFotos.onLoadStart = function(targetMC) {
targetFotos_mc._visible = false;
preloader_mc._visible = true;
};
// Durante...
loaderFotos.onLoadProgress = function(targetMC:MovieClip, lBytes:Number, tBytes:Number) {
targetFotos_mc._visible = false;
preloader_mc._visible = true;
preloader_mc.loadBytes_txt.text = lBytes;
preloader_mc.totalBytes_txt.text = tBytes;
var bytPerc:Number = Math.round((lBytes/tBytes)*100);
var totalFrames:Number = preloader_mc.ponteiro_mc._totalframes;
var proximoQuadro:Number = Math.round((bytPerc*totalFrames)/100);
preloader_mc.ponteiro_mc.gotoAndStop(proximoQuadro );
preloader_mc.infoSwf_txt.text = bytPerc;

};
//Acabada...
loaderFotos.onLoadComplete = function(targetMC) {
targetFotos_mc._visible = true;
preloader_mc._visible = false;
};
fotosMCL.loadClip(fotosURL+"foto0.jpg", "targetFotos_mc");
infoFotos_txt.text = "1/"+numFotos;
//---------</codes para trigger>----------------\
var k:Number = 0;
function proxFotografia() {
if (k<=numFotos) {
var fotoX = fotosURL+"foto"+k+".jpg";
fotosMCL.loadClip(fotoX, "targetFotos_mc");
preloader_mc._visible = true;
}
// a chave abaixo fecha o if (k) das fotos...
}
proximaFoto_btn.onRelease = function() {
if (k<numFotos-1) {
k++;
proxFotografia();
var tN = k+1;
infoFotos_txt.text = tN+"/"+numFotos;
fotoAnterior_btn.enabled = true;
fotoAnterior_btn._alpha = 100;
} else {
proximaFoto_btn.enabled = false;
proximaFoto_btn._alpha = 45;
}
};
fotoAnterior_btn.onRelease = function() {
if (k>0) {
k--;
proxFotografia();
var tN = k+1;
infoFotos_txt.text = tN+"/"+numFotos;
proximaFoto_btn.enabled = true;
proximaFoto_btn._alpha = 100;
} else {
fotoAnterior_btn.enabled = false;
fotoAnterior_btn._alpha = 45;
}
};




But the most strange parts: testing the movie IN MY COMPUTER, everything is ok! But when I publish it, I lost the totalBytes number.

Here you see the problem:

-----Editing... (04/06) sorry for the broke link...--------
http://www.ppwebart.com/testes/intermarine/seminovosX.swf
If you check this link using IE, choose a button and the "preloader" of the MovieClipLoader appears. Then, the "0" at the right is a dinamic text box wich shows the "tBytes"... How the "tBytes" is = 0, my percent is "Infinity"....
If you test the swf with Firefox the right text box shows bLoad too... (???)

Now, at this link:
http://www.ppwebart.com/testes/inter...rupaForum.html
you will see a fast video (19s) of my Flash testing the same swf, working fine....

I hope someone to help me.

Thanks a lot!

pp
pedropaulo@ppwebart.com

Xml Always Returns Last Value
i have a script what loads swf on to the the satge and then when you mose over produces a tooltip saying some text, from the xml, the only proplem is, it aways retuns the last bit of data from the xml file, here is the code..


ActionScript Code:
tooltip._visible = false;

function loadXML(loaded) {
    if (loaded) {
        xmlNode = this.firstChild;
        total = xmlNode.childNodes.length;
        for (i=0; i<total; i++) {
            swf = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
            instance = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
            tiptextxml = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
            cX = xmlNode.childNodes[i].attributes.xpos;
            cY = xmlNode.childNodes[i].attributes.ypos;
           _mc = _root.createEmptyMovieClip("Holder_" + i, i);
           _mc._x = cX;
           _mc._y = cY;
           _mc.onRollOver  = function () {
             tooltip.tiptext.text = tiptextxml;
             tooltip._x = _root._xmouse;
             tooltip._y = _root._ymouse;
             tooltip._visible = true;
             tooltip.onMouseMove = function() {
                    this._x = _root._xmouse;
                    this._y = _root._ymouse;
                                              }
                                     };
             _mc.onRollOut = function() {
             delete tooltip.onMouseMove;
             tooltip._visible = false;
                                         }
           _mc = _mc.createEmptyMovieClip("Clip", 0);
           _mc.loadMovie(swf, "id_" + i);
        }
    } else {
        content = "file not loaded!";
    }
}
function hideTip() {
    clearInterval(tipInt);
    tooltip._visible = false;
    delete _root.onMouseMove;
}



xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("data.xml")

Xml file

ActionScript Code:
<?xml version="2.0"?>
<docklets>
    <dock xpos="300" ypos="50">
        <swf>prop/God.swf</swf>
        <name>God</name>
        <tooltip>Robert</tooltip>
    </dock>
    <dock xpos="300" ypos="400">
        <swf>prop/balloon.swf</swf>
         <name>Balloon</name>
        <tooltip>On fire</tooltip>
     </dock>
    <dock xpos="100" ypos="100">
        <swf>prop/castle.swf</swf>
         <name>castle</name>
        <tooltip>Evil castel, not sean by window</tooltip>
    </dock>
    <dock xpos="100" ypos="600">
        <swf>prop/submarien.swf</swf>
         <name>submrien</name>
        <tooltip>Luke and the beetles(his homies)</tooltip>
    </dock>
</docklets>

Note i did a seach and i have not found anything like the error i have

How Many Returns Are Possible?
If I ran a function that returns three different variables with three unrelated values; can I have three returns?


ActionScript Code:
function myFunction() {
    variableA = 10;
    variableB = 20;
    variableC = 30;
    return (variableA);
    return (variableB);
    return (variableC);
}

myFunction();
trace("tracing varA: "+variableA);
trace("tracing varB: "+variableB);
trace("tracing varC: "+variableC);
What options/alternatives do I have?

Var/var Returns NaN, Then 1 ...?
i have this weird thing that happens-
when i divide r by totalrecords (_root.r/_root.totalrecords), it returns NaN.
r = 44, and totalrecords is a value (44) retrieved from a database. when i trace each var separately via textboxes, they show the
correct numbers. when i divide the variables, i get NaN. but when I advance to
the next frame and return to the first frame, the textboxes show '1' , as it
should when 44 is divided by 44 (the totalrecords). has this happened to anyone? does it sound like my code needs to be rearranged?

Ok... Need A Little Help Here (returns)
I'm kinda new at this "action script" thing... and... I confess there are somethings I just don't get it...

The problem is... I'm working with flash... and a NEED to get it...

So... problem:

I have to make a puzzle-like game, to small kids. The game is silly... just an image of a little clown, but no parts on it... no eyes, nose, mouth, arms and sorts. These parts will be of the image, on it's side. The game purpose is the kids drag the clown's parts to it's place on the clown image. But the thing is... I want this to function like this: if the kid put the part in it's right place, I want the part to stick to is place... and, no matter what, don't get off it's place... even when the kid playing click again on the part.

I already dowloaded a puzzle game, in flash, and tried to use its actions to work on my game... but it just don't work! I copied and pasted it, but it kept not working...

And... to get things worse... I DO have a deadline to get this game done... and... now its less than a week to the deadline arrives...

Please... hear my cry and help me.....

Anyway... thanks for the trouble...

NO RETURNS OR NEWLINES
I've got an e-mail submission form consisting of 3
input text fields, but returns and newlines won't
carry over. Thus, instead of recieving the following
body at Outlook Express:


__________________________________________________ __

NAME: name
E-MAIL: e-mail

COMMENTS:
mailer's comments
__________________________________________________ __



I'm getting the following body instead:


__________________________________________________ __

NAME: nameE-MAIL: e-mailCOMMENTS: mailer's comments
__________________________________________________ __



The sending code is as follows:


__________________________________________________ __________________________________________________ __________________________________________________ ____________

on (press) {
getURL (mailto add "&body=" add NAME: " add name add newline add "E-MAIL: " add emailadd add newline add newline add "COMMENTS: " add Newline add comments);
}
on (release) {
gotoAndPlay ("scenesend");
}
__________________________________________________ __________________________________________________ __________________________________________________ ____________



Can anyone help, or suggest an alternative way to
send the text field data to e-mail programmes?

::bluemoth::

Two Returns, One Function.
Hi, I dont even know if it is possible but that's why I am posting this question.
Okay, I have a function called bereken. There are two variables: x and y. The functions divides x and y and multiplies x and y. So there are two results. Is it possible to return two results??
And if it's possible how can I choose one of the results. Example: result = bereken.result1


this is the function:

function bereken(x,y) {
result1 = x/y;
result2 = x*y;
return (result1);
return (result2);
}

Thnx a lot.

GetBytesTotal() Returns -1 ?
I've got a clip called ImageContainer and within a clip called Image. On the root timeline I have a loadMovie command that loads a movie into _root.ImageContainer.Image

I am trying to preload the content into Image, but on displaying getBytesTotal() for the image it returns -1. Anyone know what I am doing wrong?
The code to display the total bytes is inside ImageContainer i.e. this.Image.getBytesTotal();

Thanks

What A Function Returns?
Hey,

I think it´s possible, but I have no idea how. I want a function to return true or false. Here a small example:
code:
function check(d,s){
if(d == "r"){
if(someVar+s > 100){
//--Value = true
} else {
//--Value = false
}
} else if(d == "l"){
if(someVar-s < -100){
//--Value = true
} else {
//--Value = false
}
}
}
this.onEnterFrame = function(){
if(Key.isDown(Key.RIGHT)){
if(check("r", 50) == true){
_x += 8;
} else {
_x += 4;
}
}
}

New Date();--Returns Nothing
I am simply trying to use new Date() to set a timestamp, But whenever I do, I get nothing. If I set 'now' to "", after running new Date, "" turns to blank????

The code:
on (release) {
_level0.Status = "Beginning Admin Process... Please Hold";
myVars = new LoadVars();
myVars.item = _level0.item;
myVars.link = _level0.link;
myVars.expi = _level0.expi;
myVars.now = new Date();
myVars.send("banner.php", "_blank", "POST");
}

any ideas?

Something That Returns Frames
Is there an actionscript that will return the frame a movieclip is on while it's playing? I'm basically trying to make a timer with minutes and seconds. I got the music on the timeline.

Why It Returns Undefined
ok, i have a file data.txt which looks like this:

Code:
&var1=aaa&


and in first frame in fla i have code like this:


Code:
loadVariables ("data.txt",_root);

if (var1==aaa){
var2=var1;
};


then dynamic text on stage, assigned to var2, returns undefined...
All i want is that var2 returned value of var1.
Please help. I suppose its all about some easy obvious little detail...

Why Can't You Use Returns With Shorthand If's?
ActionScript Code:
var blah=whatsupdawg();

function whatsupdawg()
{
    true?return"yo yo yo";
}

doesn't work. But if I write the if statement regular style like if(){} it does work. Why is this?

Returns In Multiline Being Sent To XML
ok....dumb question here.

i have a multiline text box for users to enter a short message into.

when they hit <enter> as they are typing what character are they creating? would this be a "/n" or a "/r" ?

its my xml file ends up looking like this:

Code:
<message> blah blah bla

blalbhal

blah
</message>
....i would ideally like these invisible returns to be replaced....any ideas?

robocop

GetBytesLoaded Returns NaN
Hi,

Firstly apologies if this appears somewhere else - I've not been able to find a post with the same problem that I'm having.

I'm loading an external JPEG into a placeholder movieclip using the loadMovie method. This all works fine. I'm trying to provide feedback on how much has loaded using the moviclip_name.getBytesLoaded method. Here's the AS in the first frame:

percentLoaded = Math.floor((imagePlaceholder_mc.getBytesLoaded()/imagePlaceholder_mc.getBytesTotal())*100);

where:

percentLoaded = a variable to hold the percentage loaded
imagePlaceholder_mc = the movieclip I'm loading into

I have a dynamic textfield with the variable 'percentLoaded' that shows the percentage of the image loaded.

The problem I'm having is that, at the start, percentLoaded is being shown as 'NaN' - not a number. I'm presuming that this is because Flash hasn't worked out getBytesTotal yet and so the equation defining percentLoaded isn't a number. Am I right?

I have tried various scripts to determine whether percentLoaded is, or contains, NaN, if it does then display "calculating" etc. but to no avail. I've also tried setting percentLoaded to '0%' but I still get 'NaN% loaded' in my textfield until some of the image has actually started loading - most annoying!

Has anyone got any ideas?

Many thanks,

J

Functions And Returns
I'm working through a new book on ActionScript 3. They use this example of a function and tracing the value it returns:

function moveBoarder():Number {
boarder1_mc.y -= 150;
boarder1_mc.scaleX = 2;
boarder1_mc.scaleY = 2;
return boarder1_mc.y;
}

moveBoarder();

trace(moveBoarder());

Now, the original value of boarder1_mc.y is 310. Once you run the moveBoarder() function it should be 160. And if you leave the the trace method off it is. They use this example to show how to trace value that the function returns. It should be 160. But when I run this code it is 10 and the mc has been moved up another 150 pixels.

Any idea what is wrong here? Is the example wrong? Am I doing something wrong?

Thanks for any help. Thanks!

Replacing Returns
I have an input text field where I need to replace every return or tab entered.

I tried the GREP below thinking a global search for
would get the returns. How would I replace returns?

var returns:RegExp = /
/gi;
var str:String = vf.text;
str.replace(returns, " -- "));

GetBytesLoaded Returns No Value
The fallowing preload does not work and I don't know why

on frame 1 : button gotoplay(2)

on frame 2 : movieclip loadBar and a textfield called loadText and with the fallowing AS :

loadMovieNum("1.JPG", 1);
bytes_loaded = Math.round(_level1.getBytesLoaded());
bytes_total = Math.round(_level1.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBar._width = getPercent*100;
this.loadText = Math.round(getPercent*100)+"%";
if (bytes_loaded == bytes_total) {
_level1._x = 400;
_level1._y = 150;
this.gotoAndstop(4);
}

///////////////////////////////////////
on frame 3 : gotoplay(3)
on frame 4 : statique text "Image loaded" with stop



problem : there is no bytes counting . loadText and loadBar do not work.

I think that (_level1.getBytesLoaded() ) is no the command tu use to refer to the image 1.JPEG loaded with loadMovieNum("1.JPG", 1);

GetBytesTotal Returns 0
This is really doing my nut, i'm preloading an external jpg into a movie on my stage, with a preloader on the main stage rather than the loaded movie, but it always return 0 to getBytesTotal(). Here's the code:


Code:
_root.createEmptyMovieClip('holder', 2);
holder.loadMovie("img1.jpg");
holder._x = 50;
holder._y = 50;
var l = holder.getBytesLoaded();
var t = holder.getBytesTotal();
if (l<t) {
this.texttotal.text = Math.round(t/1000)+'kb total';
gotoAndPlay (1);
} else {
// fully loaded
this.texttotal.text = "loaded";
//this._visible = false;
}

_currentframe Always Returns 1
I have a flash file, and in it is a movieclipbutton. When you roll over the button, the button has to grow in size and change color. This animation is 10 frames long. When you roll out, the button goes back to it's original size and color, this animation is also 10 frames. But when you roll out of the button before the 10 frames of roll over animation are finished, the movie jumps to the rollout animation, which starts with the button in grown size; so you see a little jump in size. To fix this, I did the following for the onRollOut:


Code:
this.btn_1.onRollOut = function() {
this.gotoAndPlay(45 - this._currentframe);
}
This however, doesn't work. When I put a trace(this._currentframe) inside, it returns 1. But this isn't right, it should return something between 10 and 20! I have the .fla file on the internet:

http://mxb.dk/upload/homePage.fla

Could anyone help me out? Thanks!

Carriage Returns?
[IMG]file:///C:/DOCUME%7E1/c_funk/LOCALS%7E1/Temp/moz-screenshot.jpg[/IMG]




for (var i:Number = 0; i < as2obj.my_galleries.gallery[arg].image.length; i++) {
gallery_mc.gallThumbs_mc.attachMovie("thumb_mc", "thumb"+i+"_mc", i);

gallery_mc.gallThumbs_mc["thumb"+i+"_mc"].thumbnail_mc.loadMovie(as2obj.my_galleries.galler y[arg].image[i].data);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._alpha = 0;
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"].alphaTo(100,.5,"linear",i*.01);

if(i < 7){
//trace("i = "+i);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._x = (58*i);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._y = 0;
}else if(i >= 7 && i < 14){
//trace("i7 = "+i);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._x = 58*(i-7);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._y = 37;
}else if(i >= 14 && i < 21){
//trace("i14 = "+i);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._x = 58*(i-14);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._y = 37*2;
}else if(i >= 21 && i < 28){
//trace("i21 = "+i);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._x = 58*(i-21);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._y = 37*3;
}else if(i >= 28 && i < 35){
//trace("i28 = "+i);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._x = 58*(i-28);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._y = 37*4;
}else if(i >= 35 && i < 42){
//trace("i36 = "+i);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._x = 58*(i-35);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._y = 37*5;
}else if(i >= 42 && i < 49){
//trace("i36 = "+i);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._x = 58*(i-52);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._y = 37*6;
}else if(i >= 49 && i < 56){
//trace("i36 = "+i);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._x = 58*(i-49);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._y = 37*7;
}else if(i >= 56 && i < 63){
//trace("i36 = "+i);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._x = 58*(i-56);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._y = 37*8;
}else if(i >= 63 && i < 70){
//trace("i36 = "+i);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._x = 58*(i-63);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._y = 37*9;
}else if(i >= 70 && i < 77){
//trace("i36 = "+i);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._x = 58*(i-70);
gallery_mc.gallThumbs_mc["thumb"+i+"_mc"]._y = 37*10;
}
}

GetBytesLoaded Returns No Value
The fallowing preload does not work and I don't know why

on frame 1 : button gotoplay(2)

on frame 2 : movieclip loadBar and a textfield called loadText and with the fallowing AS :

loadMovieNum("1.JPG", 1);
bytes_loaded = Math.round(_level1.getBytesLoaded());
bytes_total = Math.round(_level1.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBar._width = getPercent*100;
this.loadText = Math.round(getPercent*100)+"%";
if (bytes_loaded == bytes_total) {
_level1._x = 400;
_level1._y = 150;
this.gotoAndstop(4);
}

///////////////////////////////////////
on frame 3 : gotoplay(3)
on frame 4 : statique text "Image loaded" with stop



problem : there is no bytes counting . loadText and loadBar do not work.

I think that (_level1.getBytesLoaded() ) is no the command tu use to refer to the image 1.JPEG loaded with loadMovieNum("1.JPG", 1);

GetBytesTotal Returns 0
This is really doing my nut, i'm preloading an external jpg into a movie on my stage, with a preloader on the main stage rather than the loaded movie, but it always return 0 to getBytesTotal(). Here's the code:


Code:
_root.createEmptyMovieClip('holder', 2);
holder.loadMovie("img1.jpg");
holder._x = 50;
holder._y = 50;
var l = holder.getBytesLoaded();
var t = holder.getBytesTotal();
if (l<t) {
this.texttotal.text = Math.round(t/1000)+'kb total';
gotoAndPlay (1);
} else {
// fully loaded
this.texttotal.text = "loaded";
//this._visible = false;
}

HitTest Returns
Hi, i am currently creating a flash game, its kind of a space shooter.... anyway, im using a standard hitTest on the enemy ships to detect when they have been shot down.

The problem is, i need to know which ship has been shot.. is there anyway i can get the hitTest to return the instance/mc name of the ship that has been hit.

Thanks alot
Scott

Due to this being a University project, im constrained to Flash MX, rather than 2004

The Newb Returns
I've been looking for a tutorial that tells you how to have audio controls on a flash based website.
I've found a couple that are kind of unclear and un helpful.

An example of what I am talking about can be seen on a lot of band sites like this one.

I'm such a newb to flash and I have a professor that wants me to build a flash website. So expect more questions in the near future..

So does anyone know how to add audio and/or know of a good tutorial?

Thanks in advance
(Oh and I'm using MX 2004)

AS Always Returns Last XML Item
In the piece of code I'm working on a movie clip is created for each item in a XML. I have no problem reading the XML or creating the movie clip with the correct labels from the XML data. The problem arises when I try to create a function that turns the movie clip into a link that navigates to a URL. With the code below all the movie clips that are created navigate to the URL of the last item in the XML.

Code:

The XML
<videoPlaylist>
   <item>
      <title>Video 1</title>
      <desc>This is video 1.</desc>
      <path>video1.html</path>
   </item>
   <item>
      <title>Video 2 This is the second video in the XML list</title>
      <desc>This is video 2.</desc>
      <path>video2.html</path>
   </item>
   <item>
      <title>Video 3 - You get the point</title>
      <desc>This is video 3.</desc>
      <path>video3.html</path>
   </item>
</videoPlaylist>


Code:

AS3 code

//Loading the XML
var videoXMLloader:URLLoader = new URLLoader();
videoXMLloader.addEventListener(Event.COMPLETE, onVideoLoaded);

var videoxml:XML;

function onVideoLoaded(e:Event):void{
   videoxml = new XML(e.target.data);
   trace (videoxml); //trace show that the XML has loaded correctly
   
   var il:XMLList = videoxml.item;
     
        //Identifying elements in each XML item. Title, description and Path.
        var title:XMLList = videoxml.item.title;
   var description:XMLList = videoxml.item.desc;
   var path:XMLList = videoxml.item.path;
         
   for(var i:uint=0; i<il.length(); i++){
        
      var videopath = path[i].text(); //videopath variable is supposed to hold the path for the current item [i].           
               
                 //Creating the button.
      var videoButton:MovieClip = new MovieClip();
                videoButton.name = "VidButt"+[i];
      videoButton.buttonMode = true;
      videoButton.addEventListener(MouseEvent.MOUSE_UP, openPage);
      
                //Position the movie clip.
      videoButton.x = 10
      videoButton.y = 0
      
      addChild(videoButton);

               //Create a text field inside the item movie clip to contain the buttons label which is read from the XML.
      var videotitle:TextField = new TextField();
      videotitle.autoSize = TextFieldAutoSize.LEFT;
      videotitle.selectable = false;
      videotitle.defaultTextFormat = TitleFormat;
      videotitle.text = title[i].text();
      videotitle.wordWrap = true
   
      //Position the text field.
      videotitle.x = 0
                videotitle.y = 0
      videotitle.width = 500
      
      videoButton.addChild(videotitle);
               
                //The Mouse event function that opens the URL from the XML item.
      function openPage(e:MouseEvent):void{
         trace (videopath); //videopath is defined earlier as "path[i].text()" but always returns the path of the last item in the XML.
         var videoURL:String = videopath;
         var videoRequest:URLRequest = new URLRequest(videoURL);
         
         try{
            navigateToURL(videoRequest, '_blank');
         } catch(e:Error){
            trace("error occured!");
         }
            
      }

I have only recently started learngin AS so I don't know if this is an AS issue or if I am making a mistake. After hours of searching and searching some more and experimenting with structuring the process different, I can't find a solution.

Where am I going wrong and how can it be fixed?

Thanks in advance.

Duration Returns 0 With Some Flv's
Okay, for some reason when flv files are loaded into my flv player it will get duration of some videos but others the duration will return 0 for some reason...i'm guessing it happens when it's 6+ minutes long it only happens on a flv that is 7+ mins and another that is 13+ mins..heres my onMetaData code.

Code:

var meta:Object = new Object();
meta.onMetaData = function(meta:Object)
{
   trace("duration = " + meta.duration);
   oheight = meta.height;
   owidth = meta.width;
}

ns.client = meta;


any help would be awsome!

Is This Right? It Always Returns The Statement True..
Is this right?

if (_root.controltrack.type.loop._currentframe=2) {
gotoAndPlay (1);
} else {
nextFrame ();
}

or am i getting something that should be different, it always returned the statement as true and does the gotoAndPlay (1); command instead of even going on to look at the else variable. I think its something to do with the 'typeype.loop._currentframe=2' area of the script. Thanx in advance

Help Date.getTime() Always Returns The Same Value
Hey, it seems that this always returns the time that the date object was instantiated. The number never seems to change. How do you get the current time?

- Tony

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