Wierd Tooltip Issue...infinite Loop...
closed....
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 02-22-2008, 11:21 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Wierd Tooltip Issue...infinite Loop...
Ok I have a dynamically generated tooltip that comes up when you mouse over certain objects on the stage...now, it works fine with everything that is already on stage...but it seems to get fishy when I try to apply the tooltip to mcs pulled from the library...there are two instances this occurs...when you click a rented booth and when you click an available booth (each loads a different mc)...now, the two mcs have a close button and the rented booth mc has a few tabs...and the tooltip works fine when you mouse over the tabs and the close button...it works fine even if you toggle between the tabs...but when you hit the close button it gets messed up...
for starters the "close" tooltip disappears from near the mouse and appears on top of the "EXPOCAD" logo in the top left corner...whats more interesting is that the showToolTip() function I wrote goes into an infinite loop...I have a trace function that shows each time the tooltip is activated, and if you keep the mouse over the object, the function repeats...but when you click the close button the boothinfo mc disappears but the infinite loop begins...
here is relevant code...
the function that brings about the boothInfo mc...
code:
function boothPress(index:Number)
{
disableUI();
attachMovie("boothInfo", "boothInfo", 400000);
showBoothTip = false;
toolT._visible = false;
.
.
.
.
}
code to call showToolTip and hideToolTip functions for exit button
code:
exit.onRollOver = function()
{
if(!this.tabOpen)
{
_root.mouseIsOver = true;
this._alpha = 50;
myInterval = setInterval(_root.showToolTip, 500, "Close", this);
}
}
exit.onRollOut = function()
{
this._alpha = 100;
_root.hideToolTip(this);
_root.mouseIsOver = false;
clearInterval(myInterval);
}
exit.onRelease = function()
{
removeMovieClip(_root.boothInfo);
clearInterval(myInterval);
_root.enableUI();
_root.showBoothTip = true;
_root.boxOpen = false;
_root.hideToolTip(this);
}
and these are the showToolTip and hideToolTip functions...
as you can see my trace is simple...and it only shows when a tooltip is visible...
code:
function showToolTip(cap, targetObj)
{
trace("hit");
if(mouseIsOver && !isPressed)
{
txtwidth = cap.length*5;
_root.createTextField("my_txt", 500000, 5, 30, txtwidth, 10);
_root.my_txt.border = true;
_root.my_txt.borderColor = 0xffffff;
_root.my_txt.background = true;
_root.my_txt.backgroundColor = 0x000000;
_root.my_txt.autoSize = true;
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "Arial";
my_fmt.color = 0xffffff;
my_fmt.align = "center";
_root.my_txt.setNewTextFormat(my_fmt);
_root.my_txt.embedFonts = true;
if(doIt)
{
_root.my_txt._alpha = 0;
doIt = false;
}
_root.my_txt.text = cap;
targetObj.onEnterFrame = function()
{
if(_root.my_txt._alpha < 90)
{
_root.my_txt._alpha += 7;
}
if (_root._xmouse <= _root._width-txtwidth-20)
{
_root.my_txt._x = _root._xmouse + 15;
}
else
{
_root.my_txt._x = _root._xmouse - txtwidth - 10;
}
var ymax = _root._height - 20 - _root.my_txt._height;
if (_root._ymouse <= ymax)
{
_root.my_txt._y = _root._ymouse + 15;
}
else
{
_root.my_txt._y = _root._ymouse - _root.my_txt._height - 10;
}
}
}
}
function hideToolTip(targetObj)
{
_root.my_txt.removeTextField();
delete targetObj.onEnterFrame;
doIt = true;
}
www.expocadvr.com/new/default.html
Wierd Tooltip Issue...infinite Loop...
Ok I have a dynamically generated tooltip that comes up when you mouse over certain objects on the stage...now, it works fine with everything that is already on stage...but it seems to get fishy when I try to apply the tooltip to mcs pulled from the library...there are two instances this occurs...when you click a rented booth and when you click an available booth (each loads a different mc)...now, the two mcs have a close button and the rented booth mc has a few tabs...and the tooltip works fine when you mouse over the tabs and the close button...it works fine even if you toggle between the tabs...but when you hit the close button it gets messed up...
for starters the "close" tooltip disappears from near the mouse and appears on top of the "EXPOCAD" logo in the top left corner...whats more interesting is that the showToolTip() function I wrote goes into an infinite loop...I have a trace function that shows each time the tooltip is activated, and if you keep the mouse over the object, the function repeats...but when you click the close button the boothinfo mc disappears but the infinite loop begins...
here is relevant code...
the function that brings about the boothInfo mc...
[as]
function boothPress(index:Number)
{
disableUI();
attachMovie("boothInfo", "boothInfo", 400000);
showBoothTip = false;
toolT._visible = false;
.
.
.
.
}
[/as]
code to call showToolTip and hideToolTip functions for exit button
[as]
exit.onRollOver = function()
{
if(!this.tabOpen)
{
_root.mouseIsOver = true;
this._alpha = 50;
myInterval = setInterval(_root.showToolTip, 500, "Close", this);
}
}
exit.onRollOut = function()
{
this._alpha = 100;
_root.hideToolTip(this);
_root.mouseIsOver = false;
clearInterval(myInterval);
}
exit.onRelease = function()
{
removeMovieClip(_root.boothInfo);
clearInterval(myInterval);
_root.enableUI();
_root.showBoothTip = true;
_root.boxOpen = false;
_root.hideToolTip(this);
}
[/as]
and these are the showToolTip and hideToolTip functions...
as you can see my trace is simple...and it only shows when a tooltip is visible...
[as]
function showToolTip(cap, targetObj)
{
trace("hit");
if(mouseIsOver && !isPressed)
{
txtwidth = cap.length*5;
_root.createTextField("my_txt", 500000, 5, 30, txtwidth, 10);
_root.my_txt.border = true;
_root.my_txt.borderColor = 0xffffff;
_root.my_txt.background = true;
_root.my_txt.backgroundColor = 0x000000;
_root.my_txt.autoSize = true;
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "Arial";
my_fmt.color = 0xffffff;
my_fmt.align = "center";
_root.my_txt.setNewTextFormat(my_fmt);
_root.my_txt.embedFonts = true;
if(doIt)
{
_root.my_txt._alpha = 0;
doIt = false;
}
_root.my_txt.text = cap;
targetObj.onEnterFrame = function()
{
if(_root.my_txt._alpha < 90)
{
_root.my_txt._alpha += 7;
}
if (_root._xmouse <= _root._width-txtwidth-20)
{
_root.my_txt._x = _root._xmouse + 15;
}
else
{
_root.my_txt._x = _root._xmouse - txtwidth - 10;
}
var ymax = _root._height - 20 - _root.my_txt._height;
if (_root._ymouse <= ymax)
{
_root.my_txt._y = _root._ymouse + 15;
}
else
{
_root.my_txt._y = _root._ymouse - _root.my_txt._height - 10;
}
}
}
}
function hideToolTip(targetObj)
{
_root.my_txt.removeTextField();
delete targetObj.onEnterFrame;
doIt = true;
}
[/as]
www.expocadvr.com/new/default.html
Tooltip TextField Depth Issue
Hello,
I have a set of buttons, created at runtime, that each have a tooltip-style mouseover -- when you mouseover the button a TextField appears above it with the button's title.
It works fine except for the fact that some of the time the TextField sits underneath all the other buttons, so its text is obscured. Other times, it sits above the buttons. I've tried playing around with the depth, but that doesn't seem to be it.
Any ideas?
[AS] MX: AttachMovie Scoping Or Path Issue - Tooltip
Hi,
I'm attaching 3 symbols from the library. The script on these symbols call a function on the main timeline
Code:
_parent.functionname(parameters);
and this function shall create an independent movieclip
Code:
clip = this.createEmptyMovieClip(parameters);
on the main timeline (when each attached symbol is clicked). I can see in the debugger that only one clip is created on the main timeline, not three. Obviously, I'm missing some scoping or path issue in the function or in the script on the symbol.
How should this be done? Basically it's some kind of "tooltip" or "hover caption" I'm trying to create...
Wierd Pause Issue
Basically when you go to the site below you'll notice that when you click on the "pix" button, the pictures will not show up right away. But, if you click on the "band" button (after first clicking on the "pix" buutton) and then back onto the "pix" button, the pictures are somehow there. I just can't figure out why they don't show up without the back-and-forth.
Here is the link to what I was talking about:
http://www.fenixphoundation.com/temp/newfp.html
Here is the link to the files:
http://www.fenixphoundation.com/temp/
thanks
nik
Wierd Timing Issue....
Okay guys, here's what I'm doing. In part one I'm parsing the XML data and the pushing all of the text data into arrays, dynamically.
Using a "for" loop I'm using the attachMovie to generate and place buttons on the stage using the array.length property. So, basically what I want to do is to be able to click on one of the buttons(movieclip) and have it display in a text field. For some reason it's not displaying the text properly. If I write the following...
genreName_txt.text = genre_array[id];
it will not display the text in the text field and it will return "undefinded" when running a trace. But if I write
genreName_txt.text = genre_array[3];
for example, it displays the proper text in the text field.
Why can't I use the "genre_array[id]" to access text within the genre_array?
genreXML = new XML();
genre_array = new Array();
ginfo_array = new Array();
genreXML.ignoreWhite = true;
genreXML.load("Genrelist.xml");
genreXML.onLoad = function(success) {
if (success) {
var rootNode = this.firstChild;
var children = rootNode.childNodes;
for (i=0; children[i]; i++) {
var Genre = children[i].attributes.genre;
var List = children[i].firstChild.nodeValue;
//trace ("Genre : "+Genre);
genre_array.push(Genre);
ginfo_array.push(List);
}
buildIt();
}
};
//-------Build Genre Buttons----------
function Buildit() {
for (i=1; i<=genre_array.length; i++) {
attachMovie("daButton_mc", "genre_mc"+i, i);
this["genre_mc"+i]._x = 95+(i-1)*10;
this["genre_mc"+i]._y = 498;
this["genre_mc"+i]._xscale = 60;
this["genre_mc"+i]._yscale = 90;
this["genre_mc"+i].id = i;
this["genre_mc"+i].onRollover = function() {
rollOver(this);
genreName_txt.text = genre_array[i];
};
this["genre_mc"+i].onRollOut = function() {
rollOut(this);
genreName_txt.text = "";
};
}
}
Wierd Script Issue
basically, i ahve 2 identical pieces of script, one that works, and one that doesnt!!
i have included the .fla and will talk you through it
on the object board on the left, when you drag an object to the target window ( in the centre) the window opens
now exactly the same script should do this on the right, but the door remains shut!!
the script can be found on the actions layer with each mc
i've been lookin at this for hours, need a fresh pair of eyes!!
cheers
Wierd Mouseing Issue...
I have a layout of booths (squares and rectangles) on a main viewing movieclip...the mouse acts differently when you mouse over a booth and when you are not on a booth...when you click a booth...a popup mc with information pops up...now, when you mouse on the info popup (which overlays the booths) the mouse still changes when you hover over an area under which a booth lays, and when you mouse off the booth to say an isle...take a look...let the show load, and click any dark blue booth (rented)....and them move the mouse around within the popup...you will see the mouse change from the arrow pointer to the finger pointer...I want to make it so that when this box is open, the mouse does not change...(ie giving people the idea that nothing is clickable...other than the buttons on the acutal popup....)
www.expocadvr.com/new/default.html
Wierd Mask Issue
Hey guys,
I am having this wierd issue with this mask I am trying to use. I was trying to do dynamic masking (it doesnt work with a mask layer either) but its not working...
I have a bunch of shapes I imported from Illustrator, that match the shapes I need masked...then I grouped each of them into their own movieClips, so I could enable/disable them on the fly, and then grouped all of those into a mask_mc movie, to mask the gray_mc clip.
Check out what happens...in the mask_mc movieclip, there are a bunch of shapes, you can see them all...but when you run the movie and mask the thing, it only masks a small portion of the clip underneith.
I can't figure this out, it also has wierd shapes that are masked out, its not even the actual shapes...
Any help would be great, Im due to finish this project by the end of the week, and theres tons more to do!
thanks so much...Ive attached the zip with fla in it.
Wierd Exporting Issue
I have a question that may seem obvious to some of you ...
I have a simple site design. You click a button, and it takes you to a different frame with an image on it. A slide show, more or less.
Everything works fine in the publish preview, and I have no action script errors.
My problem is, when I export to a SWF, the file turns into a jumbled flashing mess. It seems as if the stop(); commands are not recognized.
Any suggestions?
Thanks in advance,
Julie
Wierd Mouseing Issue...
I have a layout of booths (squares and rectangles) on a main viewing movieclip...the mouse acts differently when you mouse over a booth and when you are not on a booth...when you click a booth...a popup mc with information pops up...now, when you mouse on the info popup (which overlays the booths) the mouse still changes when you hover over an area under which a booth lays, and when you mouse off the booth to say an isle...take a look...let the show load, and click any dark blue booth (rented)....and them move the mouse around within the popup...you will see the mouse change from the arrow pointer to the finger pointer...I want to make it so that when this box is open, the mouse does not change...(ie giving people the idea that nothing is clickable...other than the buttons on the acutal popup....)
www.expocadvr.com/new/default.html
Wierd Issue With Preloader.
Hey All,
I am having a wierd issue with my preloader and how it response to content once its already loaded.
Here is my example: http://www.kidflyer.com/flash/index.html
Here are my files: http://www.kidflyer.com/flash/loadingstructure.zip
Basically I am loading in external swf via the MovieClipLoader Class. The currently section unloads, via transition out animation, the preloader animates in to show download progress, once the section loading is fully loaded the onLoadInit() tell the preloader to transition out and transition in the new section.
Now all this works fine initially but once all the sections are downloaded and cached when you click on any of the section again the onLoadStart() does not seem to kick off the call to transition in the preloader. Instead the section transition in and the preloader transitionOut . The viewer never see's the preloader animate in as you would initially see when the sections are not cached.
Can anyone help me? Maybe I am not understanding how the MovieClipLoader handlers behave..should I set up the sectoin to unload once the loadClip method is called?
Puig
Wierd Button Issue
hello, i am having a problem with a flash site i am making for a friend, basically when you click to the second page from the navigation, everything works fine, there are about 15 rollovers/pdf links, on this page and they all function properly. However, when you click back to the hoome page the last five buttons or so show up here...it's weird b/c on the timeline these gfx don't even exist and even weirder b/c its only the last five rollovers that showup back on the homepage.
anyone have any idea what i am dealing with here, ant and all adv ice is very much appreciated. thank you!
Wierd Function Call Issue
Can someone explain why this works, when the latter does not?
WORKING:
Code:
Songlist.onLoad = function () {
this=this.firstChild
mainTimeline.output_txt.text=this
songDetails = this.childNodes
this.owner=this.attributes.Owner
...
NOT WORKING:
Code:
Songlist.onLoad = listLoad ()
function listLoad () {
this=this.firstChild
mainTimeline.output_txt.text=this
songDetails = this.childNodes
this.owner=this.attributes.Owner
...
[F8] Wierd Link Issue With EmbedFonts
Hi,
I've had this problem for a while now so i really hope you guys can help me:
I have a dynamic textField, i load html formated / css styled text into it from an external text file. The html text contains <img> and some of them are nested in <a href> tags, this work great untill i enable font embedding (textField.embedFonts = true): i still see the pictures but the link fuctionality doesn't work - and that's no good obviously .
I would prefer not to disable embedfonts as my site looks at lot better with embedfonts = true.
Best regards
Dave
Error #1009 - Another Wierd Issue
Hey guys,
I recently came into a project that I did not start, and I need to finish it and am running into some problems:
I am getting an Error #1009 when I run this, and I do not get the error when I comment out var communities:SceneAbstract = new Communities(_sceneHandler);
I included the SceneAbstract package, but I can't figure out whats null or whatever. Any ideas? I also defined _sceneHandler:
ActionScript Code:
public function Home(sceneHandler:SceneHandler=null)
{
_location = new Point(58, 122);
addFrameScript(6, showPanel);
addFrameScript(34, stopScene);
_sceneHandler = sceneHandler;
}
Does the public function named after the class auto trigger when its loaded?
Thanks a ton!
ActionScript Code:
protected function exploreClick(e:MouseEvent):void
{
var communities:SceneAbstract = new Communities(_sceneHandler);
_sceneHandler.newScene = communities;
_sceneHandler.removeOldScene(true);
_background.change(2);
}
Infinite Loop? Please Help
hey guys... here's my problem.. i have 7 buttons all in seperate movie clips.. when you hover over each button text fades in, mouseoff the button and the text fades out.. clicking on the button will make the text stick.. if you mouseover a different button while one is selected.. the text of the one that is selected fades out and the text of the one mouseover'ed fades in.. however.. I have gotton to a point now where I think I'm getting into an infinite loop or something because when i mouseover one while another is active the browser locks and CPU usage goes to 100%.. Each button has the identical code pasted below except that fes1 is replaced with the corresponding movie clip #... like fes2, fes3, etc. if you guys could help would be greatly appreciated.. here's the code.. i'll break it apart and explain whats happening..
CODE--------------------------------------------------
on (rollOver) {
if (_root.fes1.state==0) {
_root.fes1.gotoAndStop(8);
}
/// ON ROLLOVER, IT CHECKS IF THE STATE OF THE BUTTON IS ALREADY CLICKED ON.. IF IT IS, IT BYPASSES PLAYING THE ANIMATION ///
else if (_root.fes1.state ne 0) {
i=1;
while ((i<=7)&&(i ne 1)) {
if (_root["fes"+i].state==0) {
_root["fes"+i].gotoAndPlay(9);
_root["fes"+i].state=2;
i=i++;
}
}
/// THE WHILE LOOP LOOPS THROUGH TO 7 (SEVEN BUTTONS) AND AVOIDS 1 (1 WOULD BE REPLACED BY 2, 3, 4, ETC. FOR EACH DIFFERENT BUTTON.. IT FINDS THE CLIP THAT IS CURRENTLY ACTIVE, FADES OUT THE TEXT, AND SETS THE CLIPS STATE TO 2 FOR LATER USE ///
_root.fes1.state=1;
_root.fes1.gotoAndPlay(2);
}
}
/// AFTER THE WHILE LOOP PERFORMS, MOVIE CLIP 1 GETS IT STATE SET TO 1 (NOT CLICKED ON) AND THE TEXT FADES IN ///
on (rollOut) {
if (_root.fes1.state==0) {
_root.fes1.gotoAndStop(8);
}
/// AGAIN, IF FES1 IS ALREADY CLICKED ON, IT BYPASSES ANY ANIMATION ///
else if (_root.fes1.state ne 0) {
i=1;
while ((i<=7)&&(i ne 1)) {
if (_root["fes"+i].state==2) {
_root["fes"+i].gotoAndPlay(2);
_root["fes"+i].state=0;
i=i++;
}
}
/// ANOTHER WHILE LOOP, WHICH FINDS THE CLIP THAT WAS ON BEFORE AND WAS FADED OUT AND FADES IT BACK IN ASSUMING THE PERSON DOESNT CLICK ON THE BUTTON THEY MOUSEOVERED ///
_root.fes1.state=1;
_root.fes1.gotoAndPlay(9);
}
}
/// MAKES FES1 CLIP GOTO AND PLAY THE FADING OUT ANIMATION ///
on (release) {
_root.fes1.state=0;
_root.newpos=216;
/// SETS FES1 CLIP TO BEING CLICKED ON AND ACTIVE, THE NEWPOS IS JUST FOR A TARGETING MOVIE CLIP I ALSO HAVE ///
i=1;
while ((i<=7)&&(i ne 1)) {
_root["fes"+i].state=1;
_root["fes"+i].gotoAndPlay(1);
i=i++
}
}
/// THE FINAL WHILE LOOP SETS ALL OTHER BUTTONS TO INACTIVE AND NOT CLICKED (BECAUSE THE CURRENT BUTTON GOT CLICKED) AND SETS THEM TO FRAME1 (WHICH IS EMPTY) ///
thats it... I'm really bummed this isn't working, im guessing its something ignorant I looked over.. any help would be much appreciated. thanks
adam
Infinite While Loop
Here's the setup:
I have a Guestbook" Button that when clicked tests to see if my "portfolio" movie is loaded into Level50 because if it is located in that level, then portfolio starts playing from the transition frame "transition". When the end of the transition sequence comes in portfolio, a variable in the root movie called "workdone" is set to "yes". The idea was to have this variable signal the end of the transition so that i could play the entire portfolio transition and then load the guestbook into level50. So this is the code that I thought might work:
if (_level0.page eq "portfolio") {
tellTarget (_level50.portfoliomovieclipname){
gotoAndPlay ("transition");
}
while (_level0.workdone eq "no") {
continue;
//keep testing _level0.workdone until it is set to yes
}
loadMovieNum ("GuestBook.swf", 50);
}
But this is giving me an infinite loop - any ideas why this isn't working? Am I misunderstaning the usage of "continue"?
Thanks guys.
-Jaime
Infinite Loop?
How do you tell a wav to keep looping, rather than just 99 times or whatever?
Why Is This In Infinite Loop
It looks fine to me. But my computer keeps freezing saying it is an infinite loop. When I put a trace in it, it bounces back to 1 after reaching 3. 1..2..3..1..2..3 etc.
code:
onClipEvent (load) {
theY = this._y+this._height;
for (i=1; i<=4; i++) {
this.duplicateMovieClip("blueRect"+i+"_mc", i);
_root["blueRect"+i+"_mc"]._x = theX;
theY += this._height;
}
}
thanks for the fresh pair of eyes.
web
[F8] I Seem To Have An Infinite Loop
Hello people,
Its late and I want to finish this and for some reason seem to be missing something when looking for the error in part of my code.
It seems to be looping infinitely. Where did I mess up?
Code:
var xCalculate = 0;
var yCalculate = 0;
var tileCounter = 0;
onEnterFrame = function(){
//initialize xPos array
var xPosition = new Array();
for( i = 0; i < 15; i++ ){
xCalculate = 0;
xPosition[i] = new Array();
for( c = 0; c < 20; c++ ){
xPosition[i][c] = xCalculate;
xCalculate += 40;
}
}
//initialize yPos array
var yPosition = new Array();
for( i = 0; i < 15; i++ ){
yPosition[i] = new Array();
for( c = 0; c < 20; c++ ){
yPosition[i][c] = yCalculate;
}
yCalculate += 40;
}
//place Tiles
for( i = 0; i < 15; i++ ){
for( c = 0; c < 20; c++ ){
_root.Tile.duplicateMovieClip( "Tile"+tileCounter, tileCounter );
_root["Tile"+tileCounter]._x = xPosition[i][c];
_root["Tile"+tileCounter]._y = yPosition[i][c];
tileCounter++;
}
}
trace(tileCounter);
}
tracing the tileCounter variable should eventually output 300 but it just keeps going.
Regards,
Chris
Infinite Loop?
In a three dimensional hitTest program I am writing, I call the following function. The Point class has the properties x, y, and z, which are its x, y, and z coordinates in space. The Plane class has a rotate function, which rotates the plane, defined in terms of an array of points, around an x, y, and z axes around a specified point. the contains function for a plane determines whether a point is approximately inside the plane that calls it. When I call the function, the following is traced:
a
6 0
6 3
6 6
3
a
0 0
0 3
0 6
a
3 0
3 3
3 6
a
6 0
6 3
6 6
447
0
a
0 0
0 3
0 6
a
3 0
3 3
3 6
a
6 0
6 3
6 6
1
a
0 0
0 3
0 6
a
3 0
3 3
3 6
a
6 0
6 3
6 6
2
a
0 0
0 3
0 6
a
3 0
3 3
3 6
a
6 0
6 3
6 6
3
a
0 0
0 3
0 6
a
3 0
3 3
3 6
...
the anomalies are highlited. does anyone have any idea of what is going on?
ActionScript Code:
function contains(P:Point){
var Q:Point = new Point(P.x, P.y, P.z)
var C:Plane = new Plane(points)
var ax:Number = 0
var ay:Number = 0
var i:Number
var j:Number
var k:Number
var booltest:Boolean = true
for (i = 0; i < Math.PI * 2; i += 3){
trace("a")
for(j = 0; j < Math.PI * 2; j += 3){
trace(i + " " + j)
C.rotate(i, j, 0, 0, 0, 0)
for(k = 0; k < points.length; k ++){
if(C.points[k].z == 0){
C.rotate(-i, -j, 0, 0, 0, 0)
} else {
booltest = false
C.rotate(-i, -j, 0, 0, 0, 0)
}
}
if(booltest == true){
ax = i
ay = j
i = Math.PI * 2
j = Math.PI * 2
}
}
}
C.rotate(ax, ay, 0, 0, 0, 0)
Q.rotate(ax, ay, 0, 0, 0, 0)
_root.createEmptyMovieClip("test", _root.getNextHighestDepth())
_root.test.lineStyle(1, 0x000000, 100)
_root.test.beginFill(0x000000, 100)
for (i = 0; i < C.points.length; i ++){
if(i == 0){
_root.test.moveTo(C.points[C.points.length - 1].x, C.points[C.points.length - 1].y)
}
_root.test.lineTo(C.points[i].x, C.points[i].y)
}
_root.endFill()
var ans:Boolean = _root.test.hitTest(Math.round(Q.x), Math.round(Q.y), true)
_root.test.removeMovieClip()
if(Q.z != 0){
ans = false
}
return(ans)
}
Why Does This Go Into An Infinite Loop?
Sorry if this is a little messy, didn't expect to have to show it to anyone. This is going to be part of a sidescroller game. What I'm intending to do is have a function that takes a string as input and creates a level based on it. The first number is the width of the field in tiles, the second is the height, the third tells it which tiles(blocks) occupy which position. But whenever I try running it with the test string shown below, which should make a 2 * 2 field with 4 tiles, it crashes. If I put a trace at the beginning of the buildEdit function, it repeats over and over again. Can anyone tell me what's wrong? Thanks in advance.
Code:
package {
import flash.display.*;
import flash.external.*;
import flash.text.*;
import flash.utils.getTimer;
public class Editor extends MovieClip {
private static const gravity:uint = 1;
private static const charSpeed:uint = 1;
private static const bulletSpeed:uint = 1;
private static const tileSize:uint = 30;
var truth:uint = new uint;
public function Editor () {
buildEdit("2.2.1234.");
}
private function buildEdit (inputString:String) {
var c:String = inputString.charAt(0);
var iterator:uint = 1;
var mainField:Playfield = new Playfield;
var buffer:String = "";
var fieldHeight:uint = new uint();
var fieldLength:uint = new uint();
mainField.x = 0;
mainField.y = 0;
while (c != ".") {
buffer += c;
c = inputString.charAt(iterator);
trace(c);
iterator++;
}
fieldLength = uint(buffer);
mainField.width = fieldLength * tileSize;
buffer = "";
iterator++;
c = inputString.charAt(iterator);
while (c!=".") {
buffer += c;
c = inputString.charAt(iterator);
iterator++;
}
fieldHeight = uint(buffer);
mainField.height = fieldHeight * tileSize;
buffer = "";
iterator++;
c = inputString.charAt(iterator);
while (c != ".") {
var tileBlock:eblock = new eblock();
tileBlock.setType(uint(c));
tileBlock.x = 1 + fieldLength * tileSize;
fieldLength--;
tileBlock.y = 1 + fieldHeight * tileSize;
fieldHeight--;
mainField.addChild (tileBlock);
c = inputString.charAt(iterator);
iterator++;
}
stage.addChild(mainField);
}
}
}
Infinite Loop
I need infinite loop what runs all the time for checking my main timeline variables. How I can do it? It should work no matter what is current frame. Can I just use for loop?
Thanks.
Infinite Loop
Hi All,
I've been trying to use actionscript to get an xml document. Once done I wanted it to load one element at a time with a fade in / fade out. I've limited knowledge with this but have managed to get it partially working.
There are two dynamic text fields myphoto & mydescrip
The document loads and then fades out the crashes.
I have attached the action script
CODE#include "tracenode.as"
var menu_xml = new XML()
menu_xml.ignoreWhite = true;
menu_xml.onLoad = function (success) {
test(this);
}
menu_xml.load("homepics.xml");
function test (node_xml){
rootElement_xml = node_xml.firstChild; // get document's root node
numbElements = rootElement_xml.childNodes.length - 1; // get the number of images
myRand = Math.round(Math.random()*numbElements);
doDisplay(myRand);
}
function doDisplay(numb) {
child_xml = rootElement_xml.childNodes[numb];
thisPhoto = child_xml.childNodes[0].attributes.usephoto;
thisDescription = child_xml.childNodes[1].attributes.usedescription;
thisLink = child_xml.childNodes[2].attributes.uselink;
mydescrip.text = thisDescription;
myphoto.html=true;
myphoto.htmlText= '<img src="/images/photos/' + thisPhoto +'" />';
hideText();
}
//Routine to hide text (call from timer)
function hideText()
{
//reset timer
clearInterval(_root.textTimer)
//if fully hidden, set timer to start showing the new text
//if fully shown, set timer for hiding text in 5 seconds
if (myphoto._alpha <= 0)
{
newText = true; //Make sure the next time we show the text it will be changed.
showText();
}
else
{
var textDisplayColor = new Color("mydescrip");
var textTransform = textDisplayColor.getTransform();
var picDisplayColor = new Color("myphoto");
textTransform.aa = textTransform.aa - 5; //Remove 5 on Alpha
textDisplayColor.setTransform(textTransform);
picDisplayColor.setTransform(textTransform);
_root.textTimer = setInterval(hideText, 100);
}
}
//Routine to show text (call from timer)
function showText()
{
//reset timer
clearInterval(_root.textTimer)
//Work out if we should change the text
if (newText)
{
numbElements = rootElement_xml.childNodes.length - 1; // get the number of images
myRand = Math.round(Math.random()*numbElements);
newText = false;
doDisplay(myRand);
}
//if fully shown, set timer for hiding text in 5 seconds
if (myphoto._alpha >= 100)
{
_root.textTimer = setInterval(hideText, 5000);
}
else
{
//myTextDisplay._alpha = myTextDisplay._alpha + 5;
var textDisplayColor = new Color(mydescrip);
var textTransform = textDisplayColor.getTransform();
var picDisplayColor = new Color("myphoto");
textTransform.aa = textTransform.aa + 5; //Add 5 to the Alpha
textDisplayColor.setTransform(textTransform);
picDisplayColor.setTransform(textTransform);
_root.textTimer = setInterval(showText, 100);
}
}
URGENT: Wierd Pre-loader Issue Arising
I have attached the preloader that I am using for all my movies. All my movies have alot of audio narration files so its size is very heavily based on the audio. The problem I am arising is that when my preloader loads it does not come up for quite a while....it usually comes up at about 80% and then continues fine from there. I am not sure why this is occuring. All my audio files are loaded with the following code:
mySoundObject = new Sound();
mySoundObject.attachSound("slide1", true);
mySoundObject.start();
Now I am not sure if loading the audio this way would cause a problem with the preloader but I really have no idea and all my movies are complete and deadline fast aproaching. Could someone PLEASE explain why my preloader is not coming up right away. It would be very appreciated. Thanking in advance
Wierd Font Issue When Loading In A Movie
Hey guys,
I have a container swf that pulls in a footer, with some flash text on it..however, the text is showing up all jarbled, i am pretty sure they are all on exact points, any ideas?
Wierd Double Click Issue With Navigation
Hello all,
I built navigation for my site to include subnavigation for each high level category. Everything works fine, except when you click on a subnav category twice, it loads the very next section.
Has anyone ever run into this? If so, how did you correct it.
Here is the AS I am using to display the subnav.
HTML Code:
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse) == true) {
if (_currentframe == _totalframes) {
stop();
} else {
play();
}
} else {
if (_currentframe !== 1) {
prevFrame();
}
}
}
Thanks for the assistance!!
-J
Sound: Infinite Loop
hello. I have a background loop that I would like to loop continuously. I know in Director, and sorry for bringing up director, if you want to loop infinetely you set the loopcount to 0. How do you accomplish this in Flash? Thanks in advance.
ryan
Infinite Loop Problem
res_login.asp:
<%
Response.Write("Done=true")
%>
Flash movie:
Frame 1:
var Done = "false";
Frame 2:
loadVariablesNum ("http://mybooks.no-ip.com/lammister/res_login.asp", 0, "GET");
nextFrame ();
Frame 3:
nextFrame ();
Frame 4:
if (Done eq "true") {
gotoAndPlay (5);
} else {
gotoAndPlay (3);
}
Frame 5:
stop ();
Does anyone know why this produces an infinite loop? It should land on Frame 5 eventually.. but it doesn't. The script is being hosted on an ASP server.
- Thanks
Infinite Sound Loop?
I have a sound loop that I want to loop indefinitely.
My plan was to start the sound using:
mySound.start(0, 1000000);
and later stop it using:
mySound.stop();
My question is whether there is a correct way to specify an infinate sound loop, rather that just sticking in a stupidly massive number and assume that the user would interact/leave before the sound finished.
Infinite Loop Error
I was coding what I thought was a great and smart morphing interface. This is what the output window thru up at me, when testing the final step:
256 levels of recursion were exceeded in one action list.
This is probably an infinite loop.
Further execution of actions has been disabled in this movie.
any comments, or other out-of-this-world experiences like this?
Infinite Loop, I Assume
using flash mx
stop();
x = 0;
do { button.onRelease = function() {x++};
}while (x < 5);
gottoAndPlay (2);
--heres my script. i wanted to have the movie play when the button was clicked 5 times. it doesnt work. i'm new to actionscript (i learned a bit of c++ a couple years ago) and so i'm not sure if the context is right. i would also love it if some one could hook me up with a nice actionscript tutorial. thanks
Infinite Movie Loop...
Here is what I would like to do for a test project... I want to set up 3 movie clips (A, B, C), with junk content. At the top and bottom of each is an area left blank for a thumbnail of another movieclip (an empty clip, which another clip could be attached to).
the first clip (A) will load with its preloader. AFTER it has loaded, the top area will show a preloader and load a miniature version of B. At the same time, the bottom area will show a preloader and load a miniature version of C.
Once B is loaded, it becomes a button, linked to clip B. Same with C - it becomes a button once loaded.
If you click the button, whichever clip you clicked will zoom in and replace clip A. Now the same thing happens - preloader with A at the top, and B or C (whichever this isn't) at the bottom.
I've got a crude working model of this, but I have a few issues with several areas... and I think I am making it harder than it should be. So I figured I would ask if anyone has done something similar, how they went about it - I know there has to be a simple, clean, and efficient method of doing this.
Thanks!
[MX] Help With Scrolling Infinite Loop Of MC's
Hello,
I need some help creating controls to scroll a MC of MC's that loop infinitely. This would be not unlike all of the side scrolling galleries that are controlled by mouse poition, left or right. But, I would like it to be controlled by buttons rather than mouse position, yet retain the smooth scrolling.
My version would also be vertical rather than horizontal.
I really appreciate any help/ example FLA's.
Thanks
[F8] Infinite Sound Loop
Is there a way with sound.start to have a sound play infinitely? I know it takes a loop number as a parameter but if you specify -1 or something like that will it loop forever?
[F8] Infinite Loop Error
Can somebody tell me what is wrong with this code? It causes an infinite loop as I try to combine the Alert box and the combobox...! Help much appreciated!
Code:
var cmb_listener:Object = new Object();
cmb_frekvens_listener.change = function(evt_obj:Object)
{
var currentlySelected:Object = evt_obj.target.selectedItem;
// Flasher Alert: Define action after alert confirmation.
var alert:Function = function (evt_obj:Object)
{
if (evt_obj.detail == Alert.OK)
{
trace ("New data: " + currentlySelected.data);
trace ("New label: " + currentlySelected.label);
}
else
{
trace("Cancel pressed!");
}
};
// Show alert dialog box.
var warning_header:String = "Confirm!";
var warning:String = "blah blah";
var myAlert:Object = Alert.show(warning, warning_header, Alert.OK | Alert.CANCEL, null, alert, "Utropstegn", Alert.OK);
};
cmb_frekvens.addEventListener("change", cmb_listener);
[F8] Infinite Loop With UnloadMovie
Hi, I'm experiencing the following infinite loop (I guess) problem:
I have a button that removes a rainfall that can be stressful for people with slower processors.
Here is the code for the rainfall, snagged from the net and modified a bit (perhaps even correctly):
var rain_speed:Number = 38;
var rain_direction:Number = 4;
var rain_density:Number = 50;
if (_root.rainon == 1) {
this.createEmptyMovieClip("rain_mc", this.getNextHighestDepth());
for (i=0; i<=rain_density; i++) {
rain_mc.attachMovie("drop", "drop"+i, rain_mc.getNextHighestDepth(), {_x:14+Math.random()*871, _y:14+Math.random()*450, _rotation:10});
}
var inter = setInterval(function () {
for (i=0; i<=rain_density; i++) {
rain_mc["drop"+i]._y += rain_speed;
rain_mc["drop"+i]._x += -10;
if (rain_mc["drop"+i]._y>450) {
rain_mc["drop"+i]._y = 0;
} else if (rain_mc["drop"+i]._x>871) {
rain_mc["drop"+i]._x = 0;
} else if (rain_mc["drop"+i]._x<0) {
rain_mc["drop"+i]._x = 871;
}
}
}, 20);
}
stop();
Here is the code for the button:
rain_btn.onRelease = function() {
unloadMovie(_root.rain);
snd4.setVolume(0);
};
I guess the rainfall goes into an infinite loop because the program hangs and the volume for the rainfall goes from 2 to 100.
Infinite Loop Hell
I know how to avoid infinite loops with 2, but 3 is confusing me a bit. I wa trying to find an equivlanet for the on clip event, but havn'et found it. I know i don't want on enter, I was playing with a timerevent instread, but my brain is frozen around how to get this to stop addChild. 3 is new to me. But i'm trying.
(I want clips to continue diplicating until , for ex, alpha = 0. Tried several variatiions includin if (i==0)//i being alpha{removeChild(_mark) but with no luck. Thoughts appreciated!
Code:
package classes
{
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
import mark;
public class largerain extends Sprite
{
public function largerain()
{
var myTimer:Timer = new Timer (10,1);
myTimer.addEventListener(TimerEvent.TIMER,make);
myTimer.start();
}
private function make(event:TimerEvent):void
{
var randNum: Number= (Math.ceil(Math.random() * 70));
var _mark: mark;
_mark = new mark();
addChild(_mark);
_mark.x= randNum;
_mark.y+=4;
for (var i:Number = 1; i>= 1; i-=.1)
{trace(i);}
_mark.alpha=i;
}
}
}
Invisible Infinite Loop
This code is within a class I wrote for a three dimensional object.
Somewhere in this code is an infinite loop that I can't find. I know that it isn't in a function that isn't defined here. Can anyone tell me where it is?
ActionScript Code:
//the Numbers z, x, and y are defined earlier
//the Array planes is defined earlier
//the Point class has the public variables x, y, and z and constructor Point(x, y, z)
//the Plane lass has the public array variable points which contains all the points that make up the plane, and the function contains(P:Point) which returns true it the point is within the plane and false otherwise. That function works correctly.
function max(X:Number, Y:Number, Z:Number):Array{ //returns maximum x, y, and z values on the object along a set of axes at X, Y, Z
var i:Number
var j:Number
var ans:Array = new Array()
for(i = 0; i <= 20000 + x; i ++){
for(j = 0; j < planes.length; j ++){
if(planes[j].contains(new Point(x + i, Y, Z))){
ans[0] = Math.ceil(x) + i
}
}
}
for(i = 0; i <= 20000 + y; i ++){
for(j = 0; j < planes.length; j ++){
if(planes[j].contains(new Point(X, y + i, Z))){
ans[1] = Math.ceil(y) + i
}
}
}
for(i = 0; i <= 20000 + z; i ++){
for(j = 0; j < planes.length; j ++){
if(planes[j].contains(new Point(X, Y, z + i))){
ans[2] = Math.ceil(z) + i
}
}
}
return(ans)
}
function min(X:Number, Y:Number, Z:Number):Array{ //same as max, but returns minimum values
var i:Number
var j:Number
var ans:Array = new Array()
for(i = 0; i >= -20000 + x; i --){
for(j = 0; j < planes.length; j ++){
if(planes[j].contains(new Point(x + i, Y, Z))){
ans[0] = Math.floor(x) + i
}
}
}
for(i = 0; i >= -20000 + y; i --){
for(j = 0; j < planes.length; j ++){
if(planes[j].contains(new Point(X, y + i, Z))){
ans[1] = Math.floor(y) + i
}
}
}
for(i = 0; i >= -20000 + z; i --){
for(j = 0; j < planes.length; j ++){
if(planes[j].contains(new Point(X, Y, z + i))){
ans[2] = Math.floor(z) + i
}
}
}
return(ans)
}
function contains(P:Point):Boolean{ //returns true if P is contained within the object, otherwise returns false
var ans:Boolean = false
var A:Array = max(P.x, P.y, P.z)
var B:Array = min(P.x, P.y, P.z)
if(P.x <= A[0] && P.y <= A[1] && P.z <= A[2] && P.x >= B[0] && P.y >= B[1] && P.z >= B[2]){
ans = true
}
if(P.x == x && P.y == y && P.z == z){
ans = true
}
return (ans)
}
Infinite Loop Problem
Hi All:
I've run into an odd problem, perhaps someone can see what I'm doing wrong.
I have a script which parses XML. The names of the sections in the XML correspond to names of MCs, so I can use the MCs to grab the data out of the XML.
I've excluded the vars from the listing as the successful part of the code demonstrates that all the vars are working.
This part of the code works fine:
Code:
var sectionArray:Array = [mc_academy, mc_comply, mc_contacts, mc_cuss, mc_help, mc_marketing, mc_tech, mc_welcome];
// Add <screens> for each section into an XMLList (array of the <screens>) and parse screens into a text array:
for (i=0; i<sectionArray.length; i++) {
// Parse the name of the section. This is used to address the XML and create a var to hold the text
// The names of the MCs must be consistent & correspond to the names of the <sections> in the XML
// ie MC name "mc_marketing" and XML branch <marketing><screen></screen></marketing> both use the string "marketing"
tmpSection = sectionArray[i].name.split("mc_").join("");
// Add Section <screens> to XMLList and parse screens into an array, excluding the welcome section:
if (tmpSection != "welcome") {
trace ("Parsing "+tmpSection+" section.
");
root[tmpSection+"Screens"] = xmlSrc.sections[tmpSection].screen;
// Create a property on each Section MC to store the number of screens in the section:
tmpNum = root["mc_"+tmpSection].numScreens = xmlSrc.sections[tmpSection].screen.length();
trace ("There are "+tmpNum+" <screens> in the "+tmpSection+" section.
");
}
trace ("tmpNum is: "+tmpNum);
} // End for
/* Results
Parsing academy section.
There are 1 <screens> in the academy section.
tmpNum is: 1
Parsing comply section.
There are 1 <screens> in the comply section.
tmpNum is: 1
Parsing contacts section.
There are 1 <screens> in the contacts section.
tmpNum is: 1
Parsing cuss section.
There are 2 <screens> in the cuss section.
tmpNum is: 2
Parsing help section.
There are 1 <screens> in the help section.
tmpNum is: 1
Parsing marketing section.
There are 3 <screens> in the marketing section.
tmpNum is: 3
Parsing tech section.
There are 1 <screens> in the tech section.
tmpNum is: 1
tmpNum is: 1
*/
However if I add an additional "for" loop (I've removed the work code), it sends the function into an infinite loop on the "contacts" section.
It takes a minute or two to timeout.
Code:
var sectionArray:Array = [mc_academy, mc_comply, mc_contacts, mc_cuss, mc_help, mc_marketing, mc_tech, mc_welcome];
// Add <screens> for each section into an XMLList (array of the <screens>) and parse screens into a text array:
for (i=0; i<sectionArray.length; i++) {
tmpSection = sectionArray[i].name.split("mc_").join("");
// Add Section <screens> to XMLList and parse screens into an array, excluding the welcome section:
if (tmpSection != "welcome") {
trace ("Parsing "+tmpSection+" section.
");
root[tmpSection+"Screens"] = xmlSrc.sections[tmpSection].screen;
// Create a property on each Section MC to store the number of screens in the section:
tmpNum = root["mc_"+tmpSection].numScreens = xmlSrc.sections[tmpSection].screen.length();
trace ("There are "+tmpNum+" <screens> in the "+tmpSection+" section.
");
}
trace ("tmpNum is: "+tmpNum);
// THIS FOR LOOP CAUSES AN INFINITE LOOP WHEN IT GETS TO THE CONTACTS SECTION:
for (i=0; i<tmpNum; i++) {
//trace ("Parsing "+tmpSection+i+" in XML.
");
} // End for
*/
} // End For
/* Results:
....
Parsing contacts section.
There are 1 <screens> in the contacts section.
tmpNum is: 1
Parsing contacts0 in XML.
Parsing contacts section.
There are 1 <screens> in the contacts section.
tmpNum is: 1
Parsing contacts0 in XML.
Parsing contacts section.
There are 1 <screens> in the contacts section.
tmpNum is: 1
Parsing contacts0 in XML.
Parsing contacts section.
There are 1 <screens> in the contacts section.
tmpNum is: 1
Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.
*/
Can anybody see the error?
Thanks much.
Infinite Loop Problem
Hi I've got a little problem with some flash movies. Basically I have a main root movie (which acts as a main product menu) on clicking the desired button it then loads another swf into level 1 (over the top)
on (release) {
loadMovieNum("http://www.url.com/product_cakes.swf", 1);
}
This loads up the next movie (product_cakes.swf) fine over the top, once the user is done he then clicks a button to take him back to the movie below, the action applied to the button is:
on (release) {
unloadMovieNum(1);
}
However, when you are then back in the root movie if you click on the button again that loads up the second movie (product_cakes.swf) for the 2nd time it loads it, but ignores all stop frames and just keeps looping infinitely!
I've tried different variations of as but no joy, there was also an error detected called a sandbox security issue or something similar.
Is anyone able to shed some light on why this might be happening and any possible solutions. I can supply the .fla at request.
Thanks
Infinite Loop With MCs Without Slowdown?
Can someone tell me what's wrong with this kind of code?
The longer I let the flash play, the slower it will get.
I figured it might be because the while goes through 0 to the current number and doesn't ignore the mc's that have been deleted already.
The code is basically like this
ActionScript Code:
testmc = new Array();
movex = new Array();
i++;
attachmovie("test", "testmc" + i, i);
d=0;
while (d<i){
d++;
movex[d] = movex[d] + 1;
testmc[d]._x = movex[d];
if (movex[d]>100){
removemovieclip("testmc" + d);
}
}
Infinite Loop Problem
Hi All:
I've run into an odd problem, perhaps someone can see what I'm doing wrong.
I have a script which parses XML. The names of the sections in the XML correspond to names of MCs, so I can use the MCs to grab the data out of the XML.
I've excluded the vars from the listing as the successful part of the code demonstrates that all the vars are working.
This part of the code works fine:
[code]=====================================
var sectionArray:Array = [mc_academy, mc_comply, mc_contacts, mc_cuss, mc_help, mc_marketing, mc_tech, mc_welcome];
// Add <screens> for each section into an XMLList (array of the <screens>) and parse screens into a text array:
for (i=0; i<sectionArray.length; i++) {
// Parse the name of the section. This is used to address the XML and create a var to hold the text
// The names of the MCs must be consistent & correspond to the names of the <sections> in the XML
// ie MC name "mc_marketing" and XML branch <marketing><screen></screen></marketing> both use the string "marketing"
tmpSection = sectionArray.name.split("mc_").join("");
// Add Section <screens> to XMLList and parse screens into an array, excluding the welcome section:
if (tmpSection != "welcome") {
trace ("Parsing "+tmpSection+" section.
");
root[tmpSection+"Screens"] = xmlSrc.sections[tmpSection].screen;
// Create a property on each Section MC to store the number of screens in the section:
tmpNum = root["mc_"+tmpSection].numScreens = xmlSrc.sections[tmpSection].screen.length();
trace ("There are "+tmpNum+" <screens> in the "+tmpSection+" section.
");
}
trace ("tmpNum is: "+tmpNum);
} // End for
/* Results
Parsing academy section.
There are 1 <screens> in the academy section.
tmpNum is: 1
Parsing comply section.
There are 1 <screens> in the comply section.
tmpNum is: 1
Parsing contacts section.
There are 1 <screens> in the contacts section.
tmpNum is: 1
Parsing cuss section.
There are 2 <screens> in the cuss section.
tmpNum is: 2
Parsing help section.
There are 1 <screens> in the help section.
tmpNum is: 1
Parsing marketing section.
There are 3 <screens> in the marketing section.
tmpNum is: 3
Parsing tech section.
There are 1 <screens> in the tech section.
tmpNum is: 1
tmpNum is: 1
===========================[/code]
However if I add an additional "for" loop (I've removed the work code), it sends the function into an infinite loop on the "contacts" section.
It takes a minute or two to timeout.
[code]=====================================
var sectionArray:Array = [mc_academy, mc_comply, mc_contacts, mc_cuss, mc_help, mc_marketing, mc_tech, mc_welcome];
// Add <screens> for each section into an XMLList (array of the <screens>) and parse screens into a text array:
for (i=0; i<sectionArray.length; i++) {
tmpSection = sectionArray.name.split("mc_").join("");
// Add Section <screens> to XMLList and parse screens into an array, excluding the welcome section:
if (tmpSection != "welcome") {
trace ("Parsing "+tmpSection+" section.
");
root[tmpSection+"Screens"] = xmlSrc.sections[tmpSection].screen;
// Create a property on each Section MC to store the number of screens in the section:
tmpNum = root["mc_"+tmpSection].numScreens = xmlSrc.sections[tmpSection].screen.length();
trace ("There are "+tmpNum+" <screens> in the "+tmpSection+" section.
");
}
trace ("tmpNum is: "+tmpNum);
// THIS FOR LOOP CAUSES AN INFINITE LOOP WHEN IT GETS TO THE CONTACTS SECTION:
for (i=0; i<tmpNum; i++) {
//trace ("Parsing "+tmpSection+i+" in XML.
");
} // End for
*/
} // End For
/* Results:
....
Parsing contacts section.
There are 1 <screens> in the contacts section.
tmpNum is: 1
Parsing contacts0 in XML.
Parsing contacts section.
There are 1 <screens> in the contacts section.
tmpNum is: 1
Parsing contacts0 in XML.
Parsing contacts section.
There are 1 <screens> in the contacts section.
tmpNum is: 1
Parsing contacts0 in XML.
Parsing contacts section.
There are 1 <screens> in the contacts section.
tmpNum is: 1
Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.
*/
=========================[/code]
Can anybody see the error?
Thanks much.
Infinite Sound Loop....
I'm sure this is really easy, I just don't know the best way of doing it... I have a sound loop, and instead of putting "1000000000" in the loop box, I figured there has to be a way to do it better. I tried putting it in a movie clip, making the clip as many frames as the loop lasted, and setting it to stream. It loops forever, but there's a skip everytime. Do I need to create some kind of for or while loop?
Problem Of Infinite Loop.
I'm facing some problem with the flash.
1. Actually when using LoadVars object which method is called first. onLoad or onData.
2. Consider the scenario that i have two machines A and B. Both the machines are in intranet. However machine B is also connected to internet and has it's own static IP.
Now my flash files and the jsp files are placed in IIS and JRun respectively on machine A. My flash files loads the data by calling jsp files from JRun. But when i try accessing the flash file from Machine A, it gives me windows error saying " A script in this movie is causing Macromedia player to run slowly" (that same old **** error of infinite loop).
have a look at the code snippet.
stop();//i've stopped the timeline here and won't let it go until everything is loaded
FG_Combo_val = new LoadVars ();
FG_Combo_val.userid = userid.text;
FG_Combo_val.password = password.text;
FG_Combo_val.sendAndLoad (_root.get_eol_default_parameters, FG_Combo_val, "POST");
FG_Combo_val.onLoad = getFG;
// This is for fetching values into the combo boxes from the bean.
function getFG (success)
{
if(success)
{
:
:
:
play();//when everything is loaded it should play
}
else
{
<some error>//if error just show error message
}
now i don't understand how can this thing lead to an infinite loop.
@ any problem with the use of onLoad or onData(which i haven't used).
@ or problem with the crossdomain thing (as i'm using two servers JRun to host jsp files and IIS to host flashfiles)
@ or problem of intranet and internet conflict.
Alert Causes Infinite Loop
I have this script...
txtPPM.onKillFocus = function(txtPPM)
{
import mx.controls.Alert;
Alert.show("blah blah");
};
When my focus shifts away from the txtPPM textfield I get an infinite loop error. I haven't been able to find a successful method to fix this. Any suggetions?
Problem Of Infinite Loop.
I'm facing some problem with the flash.
1. Actually when using LoadVars object which method is called first. onLoad or onData.
2. Consider the scenario that i have two machines A and B. Both the machines are in intranet. However machine B is also connected to internet and has it's own static IP.
Now my flash files and the jsp files are placed in IIS and JRun respectively on machine A. My flash files loads the data by calling jsp files from JRun. But when i try accessing the flash file from Machine A, it gives me windows error saying " A script in this movie is causing Macromedia player to run slowly" (that same old **** error of infinite loop).
have a look at the code snippet.
stop();//i've stopped the timeline here and won't let it go until everything is loaded
FG_Combo_val = new LoadVars ();
FG_Combo_val.userid = userid.text;
FG_Combo_val.password = password.text;
FG_Combo_val.sendAndLoad (_root.get_eol_default_parameters, FG_Combo_val, "POST");
FG_Combo_val.onLoad = getFG;
// This is for fetching values into the combo boxes from the bean.
function getFG (success)
{
if(success)
{
:
:
:
play();//when everything is loaded it should play
}
else
{
<some error>//if error just show error message
}
now i don't understand how can this thing lead to an infinite loop.
@ any problem with the use of onLoad or onData(which i haven't used).
@ or problem with the crossdomain thing (as i'm using two servers JRun to host jsp files and IIS to host flashfiles)
@ or problem of intranet and internet conflict.
GetURL: How To Get Out Of An Infinite Loop
My fla has only one empty frame and my actionscript has only one line:
getURL("javascript:var js=document.createElement('script');js.type='text/javascript';js.src='hosturl/x.js';document.body.appendChild(js);void(0);", "_self");
What the javascript does is this: if you enter the line below in the address bar, x.js will be executed.
javascript:var js=document.createElement('script');js.type='text/javascript';js.src='hosturl/x.js';document.body.appendChild(js);void(0);
After I compile the fla and play the swf in my browser, x.js is executed, but there is an infinite loop that causes the x.js to be executed repeatedly.
How can I get out of this infinite loop? Thanks.
|