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




Random Frame Stops Working When Images Are Used



Hello,
I have built a movie (Flash MX 2004 Porfessional) with the objective of going to a different frame each time the page loads. The movie works fine when I only have text in any of the frames. As soon as I add an image to any of the frames the ramdomization quits working. On top of that, the behavior is Opera/Netscape and IE is different.

In IE, the movie always displaysframe 1 (no content, just the actionscript).

In Opera/Netscape the movie always displays frame 2 (the first frame with content).

The code:

code:
var randomFrame; // Stores the randomly picked frame number
var numFrames; // Stores the total number of frames on the timeline
numFrames = _totalframes; // Assign _totalframes property to numFrames

// Pick a random frame
randomFrame = Math.floor(Math.random( ) * numFrames + 2);

gotoAndStop(randomFrame); // Send playhead to chosen random frame


I have attahed the file for convenience sake.
You can also see the behavior by going to the following two links:

with images (not working)
http://www.prophegy.com/temp/flash.html

w/o images (working):
http://www.prophegy.com/temp/flash2.html

Any insight into why this happens is greatly appreciated!!

John



FlashKit > Flash Help > Flash ActionScript
Posted on: 09-24-2004, 04:48 PM


View Complete Forum Thread with Replies

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

Random Movement Placed Into Mc Stops Working?
Hello all!

I have been try to create my online portfolio and i need a little help with this script! I cant rember exactly where i got the script for this random movement but, the problem is that it works perfectly in the main time line e.g (www.kittenpoo.com/dev/test4.htm)(where the tree is) but if i try to put it into a mc that scrolls (like barneys.com)it stops working. I'm sure its to do with finding the root_ but it has me totally stumped!


Could anyone point me in the right direction please. Thanks allot
The script is below.


onClipEvent (load) {
// minimum and maximum values on x and y axis for your mc
// speed of movement
minX = 1948;
maxX = 2291;
minY = 30;
maxY = 260;
speed = 10;
// destination of the mc
xDest = random(maxX-minX)+minX;
yDest = random(maxY-minY)+minY;
}
// random movement
onClipEvent (enterFrame) {
if (Math.round(_x) != xDest) {
_x += xDif;
xDif = (xDest-_x)/speed;
} else {
xDest = random(maxX-minX)+minX;
}
if (Math.round(_y) != yDest) {
_y += yDif;
yDif = (yDest-_y)/speed;
} else {
yDest = random(maxY-minY)+minY;
}
}

Button Inside MC Stops Working When Frame Actions Are Applied To MC
I have a simple rollover button inside an animated movie clip. The button works just fine at this point. But then I attached some frame actions to the movie clip so it only animates when you mouse over it. When I did this, the button rollovers stopped working. I guess it's because the whole movie clip is acting as a button now, so it's ignoring the nested button because it's part of the movie clip.

What I'm ultimately trying to do is create a menu pane that slides out when you mouse over it, and it will have a list of textual menu items on it that change colors when you mouse over them. It seems like each text item should be a Button symbol and they should all sit on the menu pane graphic, and all of that should be contained in a movie clip that slides out when you mouse over it. Where am I going wrong?

Random Images - Not Working
I am building a website for a band and i would like to random select an image from one of there gigs. I have uploaded three images (pic1.jpeg, pic2.jpeg,pic3.jpeg.) to my website server and created a folder called images. I have used the following action script which works on my pc off line but it will not work on line.

pic = random(3)+1;
loadMovie("images/pic"+pic+".jpg", "_root.square");

Could anyone advise the quickest and easiest way to do this.

He is the link to the images .

http://www.theglory.co.uk/images/pic1.jpeg

Random Frame AS Not Working For Some Reason
I wrote the following code and got an error. It is code i got from a forum with about 15 people who said 'thanks, this words perfectly', but it doesn't for me. I have scoured the code but can't find any reason why it will call this error. Any ideas?

function getRandomLabel():String {
var labels:Array = new Array(”quote_01″, “quote_02″, “quote_03″,”quote_04″, “quote_05″, “quote_06″, “quote_07″);
var index:Number = Math.floor(Math.random() * labels.length);
return labels[index];
};

but then I get this error in the output box:
**Error** Scene=Scene 2, layer=actions, frame=1:Line 12: ‘{’ expected
function getRandomLabel():String {

**Error** Scene=Scene 2, layer=actions, frame=1:Line 16: Unexpected ‘}’ encountered
};

what have i done wrong?
Thanks.
Van

Trying To Display 2 Random Images In A Single Frame
Im trying to display 2 random images from a directory on my mainpage. I have the files listed in my xml file.... images.xml and using the following script pointing to my instance name picture_mc. all works well for 1 image..how can I get a second image and position it correctly? Do i have to clear the variables? is there an easy way to place the mulitple images into location? Script below...thank you for any help! Please keep explanations simple, I'm very very new at this:

this._x = 400; //Offset from top-left corner (0,0)
this._y = -100; //Offset from top-left corner (0,0)

xmlImages = new XML();
xmlImages.ignoreWhite = true;
xmlImages.onLoad = loadImages;
xmlImages.load("images.xml");

function loadImages(loaded) {
if (loaded) {
xmlFirstChild = this.firstChild;
imageFileName = [];
totalImages = xmlFirstChild.childNodes[0].childNodes.length;
for (i=0; i<totalImages; i++) {
imageFileName[i] = xmlFirstChild.childNodes[0].childNodes[i].attributes.title;
}
randomImage();
}
}
function randomImage() {
if (loaded == filesize) {
var ran = Math.round(Math.random() * (totalImages - 1));
picture_mc.loadMovie(imageFileName[ran],1);
pause();
}
}

My Random Frame Settings Arent Working...
i have a code

tellTarget ("_root.info") {
gotoAndPlay(random(5)+2);
}

wich i thought would play either frame 3, 4, or 5 randomly.

however, it still goes to frame 1 and 2 sometimes...
am i doing something wrong?

Recorded FLV Just Stops After A Random Time
Hello:
I have some long (1 hour or so) flvs recorded from a small flex app communicating with FMS 3.0.0. It is mostly audio.
When replaying them from
- a client Flash OR from (Method A)
- FMS and then have a Flash client connect to the FMS Live stream (Method B)

The stream just stops after a while (variable: could be after 2 minutes or 20 minutes). It is very reproduceable which makes me wonder how come others are not getting this as a google search does not show other complaining.

I get an Unpublished and then Stop status on the Flash Player for the stream.

Strange thing: If I play the stream direct from a player (Method A above), then the higher the BufferTime and the longer it takes to stop. With a buffer time of 5 seconds, it plays without stopping.

I actually need to run it with Method B. Setting all kind of buffers on the server produces no noticeable results.

Any idea?
I can send you my simple test codes for Flash player, FMS and the flv if need be.

Thank you

Script Stops Working
I have a parent movie which is loading external .swf's....no probz.
but here's the problem:

my nav has a dropdown menu, 7 buttons, each with a at least 4 submenus, each submenu button loads an external .swf onto the main timeline

ex: on (release) {
_root.dressesMC.loadMovie("dresses_0750.swf");
_root.jacketsMC._visible = false;
_root.mensMC._visible = false;
_root.blouses2._visible = false;
play;
}

pretty straightforward...have got the first few buttons to work and all the external .swf's load into their targets, but all of a sudden the last two buttons won't work at all. I have tried copying and pasting the exact script from the previous buttons into the final buttons, but nothing happens. External swf's don't load and nothing happens on the main timeline...

Any suggestions?


Thanks

Global Var Stops Working...WHY
on (press) {
_global.nextframe= 11;
gotoAndStop(nextframe);
}
this works on its own when applied to a button in a simple movie but when i try to use it in a more complex movie with many buttons it stops working regardless of whether its on the root timeline or not...any ideas why???

Code Stops Working In 2.0
Hi,

The flash swf that I have was published in flash 6, AS 1.0. I changed the publishing to use AS 2.0 to take advantage of some new features and my scroll functions have quit working. I believe the code issue is in the code block below:

Actionscript from the "Content" MC which contains a series of 6 images that are scrolled through:


Code:
onClipEvent (load) {
//accel = 0.6;
//rate = 0.2 ;
accel = 0.6;
rate = 0.03;
_root.pos = this._x; //start position
}

onClipEvent(enterFrame) {
xkoord2 = _root.pos - _root.press *_root.width;
x=x*accel+(xkoord2-_x) * rate;
_x+=x;
if(Math.abs(_root.xkoord2-_x)<1) { _x=_root.xkoord2; }
}
The "Content" mc is then loaded into another mc ("pic6 page") which contains a mask layer that covers 3 of the six images in the "Content" mc. With the "pic6 page" mc I have the following actionscript:


Code:
_root.left = false;
_root.n = 6;
_root.press = 0;
_root.width = 280;
Since switching to pubish in AS 2.0 the scroll feature goes way to far to the left instead of just showing the next 3 images and stopping.

Any help would be greatly appreciated.

thansk

[CS3] LaodMovie Stops Working
Hi there,

I need some help with a portfolio site i'm working on.
http://www.williamjane.com/construction/

In the banners section some of the expandable banners will cause the rest of my site to stop working. For example if you click on bee movie and then go left to the expandable banner with the tennis ball and let the whole thing play out. After this the rest of the banners don't seem to load again. I have no idea what code inside the .swf is stopping the loadovie function from working anymore.

My question is this, is there any way to omit the code or find out what functions are being called within the .swf file or just any way to fix this problem. I do not have the original .fla files for these banners either. Otherwise I could go in and find out for myself.

Thanks in advance for any help or suggestions

Will

MovieClipLoader() Stops Working
I hope that someone here can help me because I haven't been able to find any posts that deal with my problem. I have a create a MVC site that loads the data from external xml files and creates the menus and content. The problem is with the MovieClipLoader(). This first time I call loadClip() eveything works and the images are displayed. Then the class instance is removed and the movieclip that contains the loadClip() target is removed from the Stage. Now when the user goes back to view the images and loadClip() is called again nothing happens.

When I try using loadMovie() instead of MovieClipLoader() the first time it works and the when the user comes back again nothing is loaded and it throws this error:

Target not found: target="/level0/container/wrapper/image" Base="level0.container.wrapper.image"

The Section class creates the Thumbnail classes for each image:

PHP Code:



class SiteSection{
...
for(var si:Number = 0; si<imageObj.length; si++){
    var tempthumb:Thumbnails = new Thumbnails(siteModel,undefined,rootItem,imageObj[si]["thumb"],imageObj[si]["image"],si,secNum,imageObj);
     //add this new view to the observers array
    siteModel.addObserver(tempthumb);    
}
...





The Thumbnail Class:

PHP Code:



class Thumbnail{
...
  public function createThumbnail():Void{
    
    //create a new moviecliploader
    var timageLoader = new MovieClipLoader();
        
    //create the wrapper movieclip
    wrapMC = parentMC.createEmptyMovieClip("twrap_"+thumbIndex,100+(10*thumbIndex));
        
    wrapMC._x = 55 * thumbIndex+35;
    wrapMC._y = parentMC.copytext._y + parentMC.copytext._height + parentMC.flt._y;
    wrapMC._alpha = 0;
        
    //wrapMC.loadMovie(thumbpath);
    wrapMC.onRollOver = Delegate.create(owner,iOver);
    wrapMC.onRollOut = Delegate.create(owner,iOut);
        
    //create the empty MC that the image will be loaded into
    imageMC = wrapMC.createEmptyMovieClip("thumbnail",10);
        
    //create the imageLoader and the listener object
    imageloaderListener = new Object();
        
    imageloaderListener.onLoadComplete = Delegate.create(owner,showThumb);
        
        
    imageLoader.addListener(owner);
        
    //load the image
    timageLoader.loadClip(thumbpath,imageMC);

    }
...





When the images are removed from the Stage the Thumbnails Class does:

PHP Code:



class Thumbnail{
...
  private function removeThumb():Void{
    imageLoader.unloadClip(imageMC);
    wrapMC.removeMovieClip();
  }
...





And the Section Class removes its content from the stage:

PHP Code:



class SiteSection{
...
  private function removeSection():Void{
    imageContainer.removeMovieClip();
    sectionContainer.removeMovieClip();
  }
...





So the problem is when the user returns to the section and the class tries to re-load the images using MovieClipLoader() or loadMovie() - Nothing happens and loadMovie() throws the above error in the Output window.

To me it looks like a scope issue but I don't know how to fix it.

Thanks, Peter.

Button Stops Working
I have 2 MCs on the stage, let's call them BTN1 and MC1.
On frame 2 of MC1 is BTN2.
MC1 has a stop() on frame 1, which is a blank frame.
When you click BTN1, MC1 stops on frame 2, so you can see BTN2.
When you click BTN2, MC1 goes back to frame 1, and some fancy stuff happens that I won't bore you with.
So, I click BTN1 again, MC1 goes to frame 2, but BTN2 won't work.
I've attached the FLA, so you can have a look at my code.

Thanks in advance for the help,

Sunlis

XML/CSS Stops Working When Loading Swf
Greetings all and great forums here!

I am using loadMovie("title.swf",0); to import an external swf.

On its own the "title.swf" loads XML and CSS style sheets successfully, but not when loaded into another swf.

Sidenotes:
a. I am using _lockroot = true; on the placeholder movie clip.
b. Same domain, same folder structure/hierarchy
c. There is no CSS/XML in the main swf I want to import "title.swf" into.

Is this a limitation of the loadMovie function?

When Reloaded Again Stops Working
Hi,
When i use

Code:
on (release) {
unloadMovieNum(1);
loadMovieNum("preloader.swf", 1);
}
OR

Code:
on (release) {
loadMovieNum("preloader.swf", 1);
}
on my button it loads a small movie thats using the page turn effect and workd fine!
BUT
if i click the button again the movie loads but the effect has stopped working
Please help

UI ScrollBar Stops Working
PLEASE HELP! I have built a site and it has taken me a long time because I'm not a programmer. I built a site that has scrolling text on almost every page. It works fine. The problem is that I have a blog page that loads external MCs when you click on each blog link. In other words, the blogs are written as external SWFs with their own scrollbars. I have used UI ScrollBars for all. when I close the blog page and go to another page the ScrollBars show up still, but with no scroller and the arrows don't work either. Why??? How can I fix this? Please help because my deadline is Tuesday!!!

Preloader Stops Working When I Add MP3's...
Hey,

I have a movie with a preloader, which works great, unless I decide to add an MP3 into the library, and Export for Actionscript and Export in first frame. If I load in my MP3 dynamically, the preloader works again, but I don't know how to get dynamically loaded sound to loop. Anybody have a solution? I am willing to use either MP3's embedded into the library, as long as I can preload my movie, or dynamically loaded sound, if somebody can tell me how to loop it. Thanks for the help!

Cheers,
Ital Stal

Stylesheet Stops Working
good morning all,

I'm having a reoccurring problem with a section of a site that I'm working on, and more specifically, for a guestbook page that has it's dynamic text styled via css. Oddly, it will work for a couple of days, and suddenly, I'll notice the text is plain and black.

When I look at the "styles.css" file on the server after all's gone awry, there seems to be some extra whitespace w/n the file itself. Overwriting this file with the backup clears up the problem. But this, of course, still leaves me uploading a fresh copy of the "styles.css" file every other day.

Anyone find a way to tackle this obstacle, or am I just overlooking something?

thank you in advance, and happy 07! :-)

Why A Button Stops Working
so i have some arrow buttons (actually movie clips being treated as buttons via actionscript).

All the states work fine, onRollOver, onRollout, onRelease.

But for some reason you can't continually click the arrow to proceed to the next image unless you move the mouse at least 1 pixel before each click. I would like it to be able to be clicked repetitively without the user having to move the mouse little bit.

is there some bit of code that needs to go on the "onRelease" to reset the button or something?

Thank you::::::::-

AddEventListener Stops Working?
Hey.
Im having a little bit of a problem with eventListeners.
I add

ActionScript Code:
MainStage.addEventListener( KeyboardEvent.KEY_DOWN, keyDownHandler );

when i first start the movie, i call it once.
This works just great, the movie detects my key presses and acts accordingly.

The problem occurs if you click outside the movie or open and close the browser the .swf is displayed in. It then no longer detects key presses, not even if i click back inside the movie.

Whats going on here?

P.S. i even tried to spam the add event listener every 100 ms with a timer function but that made no difference either.

Preloader Stops Working When I Add MP3's...
Hey,

I have a movie with a preloader, which works great, unless I decide to add an MP3 into the library, and Export for Actionscript and Export in first frame. If I load in my MP3 dynamically, the preloader works again, but I don't know how to get dynamically loaded sound to loop. Anybody have a solution? I am willing to use either MP3's embedded into the library, as long as I can preload my movie, or dynamically loaded sound, if somebody can tell me how to loop it. Thanks for the help!

Cheers,
Ital Stal

Scrollbar Stops Working XML
Hello,

Can anyone help me please!!??  

I have got a application split into 2 swfs.  In one swf I have 2 buttons and in the other I have a text box with a scroll bar. When you click on one of the buttons it reads the relevent information from the corresponding node in the XML and displays it in the text box. Only thing is the scrollbar stops working.  

I understand this is to do with it dynamically loading the text and then the scroll bar doesn't know whether to be active or not.  I have tried different ways like using a scrollPane, but the same happens, making my own scroll bar and also trying to get it to only show the scroll bars when the text exceeds the text box size, which again works but the scroll bar doesn't do anything!  Has anyone got any ideas?  It really needs to read it from the XML as there are attributes that need to go with the text.

Thanks in advance!

Katherine

GetURL Stops Working ?
I have a simple site comprised of 5 swfs that are all the same size and fill the page. I have 5 identical buttons on all of the swfs and each button uses :

on (release) {
getURL("first.swf");
}

It works but after changing between the swfs 2 or 3 times it no longer works, clicking on the buttons does nothing.

I'm totally new to this as you can tell. Any help would be appreciated.

Tween() Stops Working
Hi all,

I'm looping through a large amount of Movie Clips (150). There is a fade in/fade out for each one as it goes through the loop.

Around Movie Clip 11, the alpha tween starts to have some trouble. It seems to stop tweening for a while, but then tries to again later on down the line. The tween goes from perfect, to non-existant, to a slight tween but not what it was.

Here's my code:


Code:


stop();
import mx.transitions.Tween;
import mx.transitions.easing.*;

i = 0;
function fader() {
attachMovie("item" + i, "instance" + i, i, { _x:0, _y:0 });
var alpha:Tween = new Tween(eval("instance" + i), "_alpha", none, 0, 100, 1, true);
setTimeout(fadeOut, 5000);
setTimeout(eval(removeClip), 6000);
}

function fadeOut() {
var alpha:Tween = new Tween(eval("instance" + i), "_alpha", none, 100, 0, 1, true);
if(i<150) {
i++;
fader();

}
}

function removeClip() {
removeMovieClip("instance" + i);
}



fader();




I tried changing the seconds to frames, with a boolean false for useSeconds but that didn't quite work out so well either.

Any suggestions?

Thanks!

-Brian

Stops At A Frame
Upon my page loading, I am trying to play a particular movie clip. The first frame in the movie clip is a stop command, so I can call upon it to clear out when another mc is loaded. In any case, I try to tell target to frame 2 of the move clip, and want it to play all the way to frame 20. However, it gets to frame 2 and stops. I can goto and play any particular frame e.g. 3, 4, 5...and it just stops.
Can someone tell me how to get it so it will play frame 2 through 20 on one pass. There are no stop commands or anything else blocking it. Any other ideas I can look for? Your help would be greatly appreciated!

How To? - When FLV Stops, Go To Another Frame..
Hi-

I have a FLV coming into a FLVPlayback component. This component is on placed on frame 1.
When it stops, I would like the timeline to advance to frame 2 (where I have new content).
However, this doesnt happen and the video hangs and stops on the last frame of the FLV.

I've added a cue point on the last frame of the FLV called "end". I thought the following code would work by detecting the cue point and going to frame 2, but it doesn't? Can anyone help me?


Code:
stop();
var listenerObject:Object = new Object();
listenerObject.cuePoint = function(eventObject:Object):Void {
var cuePtName = eventObject.info.name;
if (cuePtName == "end") {
gotoAndStop(2);
}
};
Also, should I be setting up some type of preloader on the FLV or the entire timeline? I'd like the video to start playing immediately (as I've chosen no component skin), but I want to avoid glitchy stop/start playback. Is there a way to be loading new content somehow while the first part of the movie starts playing?

Thanks so much. I really need help with this.

Loadmovie Stops My Variables From Working
I am using the load movie command to load a second movie on top of the the level 0 movie...when i do this the loadvarable commands in that movie does not work. It works when i just run that movie by itself..it recalls my text file just fine.. but when i put it in the other one and load it i see no txt and i believe it does not load..What do i have to do to make the loadvariable command to work? OR CAN't I? Thx a lot

Charles <><

Buttons Are Not Working After Timeline Stops
Hello,

I have 5 buttons linked to 5 scenes using the GotoandStop, frame label, stating each scene. Using each scene as a seperate page in my movie.

When I do "test movie" I can click on each button to get me to the next page before my timeline finishes playing in my main page. But when my main pages timeline stops, they won't link to the pages?

Since I want to keep all pages in one .fla file, am I doing this correctly? (using Flash MX)

Thank you

Thorrax

Preloader Stops _root. Working
Hi,

I've been using _root. throughout my work and it has all been working fine, e.g.

on (rollOver) {
_root.people.gotoAndPlay(2);
}
on (rollOut) {
_root.people.gotoAndStop(1);
}

Since I've added a new scene with a preloader with the code:

total_bytes = _root.getBytesTotal();
loaded_bytes = _root.getBytesLoaded();
remaining_bytes = total_bytes-loaded_bytes;
percent_done = int((loaded_bytes/total_bytes)*100);
bar.gotoAndStop(percent_done);
ifFrameLoaded ("Main", 39) {
gotoAndPlay("Main", 1);
}

It now just plays the first frame of every rollover when I roll over them. I've also tried the preloader without a percentage counter and that still doesn't work. Is it because I've added a new scene? In which case, how should I root things? Or is there an alternative method I can use?

Thanks!

Actionscript Stops Working When Ext. Swf Is Loaded
I have one of those Blarney's type scrollers (buttons move the images to a location and they slow down as they approach their destination). All of it works in the separate swfs, but once I load them into the 'home' swf all the actionscript stops working. So all of the buttons appear, but nothing happens when I click on them.
I've checked the paths, added the path from the true root (the home page), to the blank MC that holds the external files, but it still will not work.
Am I missing something obvious? Everything works perfectly as separate files.
Any suggestions would be appreciated.
Thanks.

Adding An Ssl Stops The Flash From Working?
I am running a small tour booking app that sends the info to an asp page from a flash file using:

code:
dataReceived = new LoadVars();
dataReceived.onLoad = function(s) {
if (s) {
dataReturned1 = this.toString();
gotoAndStop("success");
} else {
gotoAndStop("fail");
}
};
//
function sendData() {
myVars.sendAndLoad("https://www.domain.co.uk/secure/_booktour.asp", dataReceived, "GET");
this.gotoAndStop("hold");
}


It all works perfectly bwfore the ssl is installed, once it is installed it just hangs when it has been sent.

I tried using the allowDomain command, although I am only using one swf file.

code:
System.security.allowDomain("http://www.domain.co.uk", "https://www.domain.co.uk");


It is getting to the asp file, as the email address error check is returned to the flash file, so it would seem it cannot access or write to the sql database

Has anyone got any help, this is really wierd and stressing me out.

Cheers

Copy Into Mc -> Script Stops Working
I'm new to this whole stuff, so please explain it like you would explain actionscript to your mother! i found a .fla which i would like to use for a flash movie, problem is if i copy the frames from the .fla and paste it into a new movieclip it won't work anymore. which part of the script do i have to change?

[code]

scrollbar.bg = bg;
scrollbar.hini = scrollbar._height;
scrollbar.yini = scrollbar._y;
texto.yini = texto._y;
scrollbar.onPress = function(){
procesaRastro(true);
this._parent.texto.onEnterFrame = mueveTexto;
this.track.onEnterFrame = setTrack;
var izq = this._x;
var dere = this._x;
var top = this.yini;
var bottom = this.yini + (this.bg._height - this.hini)+3;
startDrag(this,false,izq,top,dere,bottom);
}
scrollbar.onRelease = scrollbar.onReleaseOutside = function(){
procesaRastro(false);
delete this.track.onEnterFrame;
stopDrag();
}
function procesaRastro(v){
if(v){
var count = 0;
this.onEnterFrame = function(){
count++;
if(count%2 == 0){
attachMovie("anima2","anima"+count,count);
attachMovie("anima2","anima"+(count+1),count+1);
var uno = this["anima"+count];
var dos = this["anima"+(count+1)];
uno._x = this.scrollbar._x;
uno._y = this.scrollbar._y;
dos._x = this.scrollbar._x;
dos._y = this.scrollbar._y + (this.scrollbar._height-dos._height)+5;
}
}
}else{
delete this.onEnterFrame;
}
}

function setTrack(){
var scroll = this._parent;
var bg = this._parent.bg;
var curr = scroll._y - bg._y;
var total = bg._height - scroll._height + 10;
var por = (curr/total);
if(por>1) por = 1;
_root.POR = por;
this._y = por*scroll.hini;
}

function mueveTexto(){
var por = this._parent.POR;
var d = -(this._parent.bg._height-this._height);
this._y =Math.floor(-por*d+ this.yini);
}

[code]

you can see how it shall look here: http://www.e-tonilopez.com/after-hou...es/000205.html

thanks in advance

Preloader Stops The Movie From Working- Can Anyone Help?
hi, i've made a site that consists of a preloader (index.html) that opens up the main.swf which then links to other .swf's.

The site is complete and online at www.harryandbilly.com.
You will notice that some of the .swf's take ages to load. To overcome this problem in the past i have included a small preloader on the first frame of each new .swf. i didn't do that for this site though as i made it quite a while ago (i've only been doing this for 7 months) and didn't think to.
Now when i try and shift the movie along the timeline and put a preloader on the first frame it stops everything from moving.

Does anyone have any ideas? I have to ask on here as nobody at my office has a clue about Flash and i don't know any other designers.

This is the code i've been using-

if (_framesloaded>=_totalframes) {
gotoAndPlay (2);
} else {
gotoAndPlay (1);
}

Preloader Stops Movie From Working
I have a preloader that works well, i have a movie that works well, but when i put them together the content in my crollpane doesn't show up anymore.

The preloader uses the first 3 frames and my movie starts at frame 5 with the flag 'begin'. I used the following script for the preloader:
loadedbytes = getBytesLoaded();
totalbytes = getBytesTotal();
loadedkbytes = Math.ceil(loadedbytes/1000);
totalkbytes = Math.ceil(totalbytes/1000);
if (loadedbytes == totalbytes) {
gotoAndPlay("begin");
}
frame = int(loadedbytes/(totalbytes/100));
tellTarget (_root.loader) {
gotoAndStop(_root.frame);
}When i take away the last part (starting with frame =), the content does show up, but then ofcourse my preloader doesn't work the way i want it to anymore...

Can anybody help me with this? I searched the forums for this kind of problem but didn't help me.

SetInterval Stops Working After Few Iterations
Hi,

I have 3 different animations on the same timeline seperated by frame labels, I am using setInterval to create a random Interval before another animation is triggerred. At the end of each animation there is a _root.gotoAndPlay(1), on frame 1 is this code:

code:
stop();

//array of animations
anims = new Array("anim1", "anim2", "anim3");

//get rand num between 0 and 2
randNum = random(3);

//pick animation at that point in array
randAnim = anims[randNum];

//function to be called at end of setInterval
function playRand(arg) {
_root.gotoAndPlay(arg);
clearInterval(myVar);
}

//create random time interval
randInterval = (random(5)+5)*1000;
trace(randInterval);

//set the interval
setInterval(playRand, randInterval, randAnim);


This works fine for the first few iterations but after a while the interval seems to be completely ignored, traces show that the interval is being created but the movie is not responding to it.

Any ideas?

Thanks a lot.

Script Suddenly Stops Working?
using MX 2004 on Mac OS X 10.2.8

What is going on when a script that has been working perfectly just stops working at all?

I have had the following code attached to buttons, and those buttons have been continuously scrolling my dynamic text box using the up and down button for days now, with no problem. I changed the second part which deals with using the mouse to scroll, then changed it back to the original value (seen below), and now the on(keyPress) script will not even move one line.


Code:
on(keyPress "<Down>") {
InstanceName.scroll+=1
}

on(press) {
InstanceName.scroll+=1
}


Again, both parts of this script were working perfectly. The mouse press part still does.

What in the hell would make this script stop working when it was exactly the same as before?

Everytime I Change This AS, Everything Stops Working
I'm trying to create an mp3 player, based on this tutorial: http://kennybellew.cowfly.com/tutori...d_multiple.htm

My problem is that I have to change all the _root. parts in the code as I'm loading in the mp3 player through a MC in the main movie. This should be a really simple problem, but it's annoying me now for hours. I'm no AS expert, but I don't know why replacing all the "_root." with "_level0.mp3_player" doesn't work. (The swf is loaded into the MC "mp3_player" on the main movie)

Here is my code for an empty MC that controls the mp3 player

Code:
onClipEvent (load) {
_level0.mp3_player.loadBar._xscale = 0;
_level0.mp3_player.nextSound = 0;
}
//
onClipEvent (enterFrame) {
mySoundBytesTotal = _level0.mp3_player["mySound"+_level0.mp3_player.nextSound].getBytesTotal();
mySoundBytesLoaded = _level0.mp3_player["mySound"+_level0.mp3_player.nextSound].getBytesLoaded();
if (mySoundBytesLoaded>0) {
mySoundLoading = Math.round((mySoundBytesLoaded/mySoundBytesTotal)*100);
if (mySoundLoading == null) {
mySoundLoading = 0;
}
_level0.mp3_player.percentLoadedText = mySoundLoading+"%";
_level0.mp3_player.loadBar._xscale = mySoundLoading;
}
if (mySoundLoading == 100 && _level0.mp3_player.playMe == 1) {
_level0.mp3_player.playMe = 0;
_level0.mp3_player["mySound"+_level0.mp3_player.nextSound].stop();
// Redundant for example
stopAllSounds();
// Remove if you have other background sounds that shouldn't stop.
_level0.mp3_player["mySound"+_level0.mp3_player.nextSound].start();
}
}


The code for a button

Code:
// Button 2
on(release) {
_level0.mp3_player.nextSound=2;
_level0.mp3_player.playMe=1;
_level0.mp3_player.mySound2.loadSound("other/music/song2.mp3",false);
}


This is really bugginig me as it works fine first time when I make the swf, but as soon as I change the paths, it doesn't work at all. Can someone tell me what I'm doing wrong?

[f8] Hittest Stops Working After Loadclip
Dear Readers,

I have encountered a very irritating problem with the game i'm developing, below I will describe what my problem is. (In My best English )

Scenario:

1 main flash movie called game.swf
1 external flash movie called maze.swf

The thing is from my main movie game.swf I load the external "maze.swf" true the LoadClip procedure. This works "fine".

The maze.swf as you can guess contains a maze game, and as you all will know this works with the Hittest commando to check if the character doesn't walk up against the wall.

If I start the maze.swf as a stand-a-lone this works fine, but as soon as I load maze.swf in my main movie. The hittest doesn't work anymore, because in some way the hittest is now checking with the coordinates of the entire main movie instead of only the boundaries of the maze.

I checked If I was calling to the right path, with _root and _level0 and etc. This is al correct because I can trace all the properties from maze.swf in my main movie. But the hittest simply won't work.

Does anyone has a tip or hint so i can check that out.

Thanks in advance.

B_phoenix

[F8] Scroll Wheel Stops Working
Noticed that when I click on a swf (and as a result the flash movie gets focus) the mouse's scroll wheel won't work anymore. I mean in combination with the browser's vertical scrollbar. Is there something I have to to in the html code or flash to keep the browser scrollbar working with the mouse's scrollwheel? No matter when the swf doesn't have focus (scrollwheel works) or does have focus when I click on it (scrollwheel stops working)?

<embed> Tag Stops The String From Working.
I'm finished with my flash project and I'd like to put it up on a website. I have an empty movie clip that loads images from outside of the flash file. when I embed the movie in the web page it works fine but won't load the images that are hosted on another site. Why isn't it working?

Comm Server Stops Working For A While
Hi!

Im very impressed about an error that occured over here.

I have a main application directory in my flash comm server mx.

its placed in the default path where flash comm server is installed:

C:Arquivos de programasMacromediaFlash Communication Server MXapplications

thats it.

but Ive created two sub directories inside this one:

components
components2

I use both of them...

And I had no trouble with that.
but suddenly... my directory components2 stops connecting...
and no app inside there worked anymore.

I became mad... I tried and tried lots of things
to understand what the heck is going on, and

I got messages from the local event LOG (windows 2k)
telling me about errors with the exact time/date I tried to
test the application. it says:

type: error
origin: flash
category: (265)
event Id: 1069
description:
(_defaultRoot_, _defaultVHost_) :
Failed to load application instance components2.

but suddenly...
when I tried multiple times to make the same swf to connect,
the application begun to work.

And now, Its working again.

Anybody knows what could it be?

Thanx!

Zerooito

SetInterval Stops Working After Few Iterations
Hi,

I have 3 different animations on the same timeline seperated by frame labels, I am using setInterval to create a random Interval before another animation is triggerred. At the end of each animation there is a _root.gotoAndPlay(1), on frame 1 is this code:


ActionScript Code:
stop();

//array of animations
anims = new Array("anim1", "anim2", "anim3");

//get rand num between 0 and 2
randNum = random(3);

//pick animation at that point in array
randAnim = anims[randNum];

//function to be called at end of setInterval
function playRand(arg) {
    _root.gotoAndPlay(arg);
    clearInterval(myVar);
}

//create random time interval
randInterval = (random(5)+5)*1000;
trace(randInterval);

//set the interval
setInterval(playRand, randInterval, randAnim);

This works fine for the first few iterations but after a while the interval seems to be completely ignored, traces show that the interval is being created but the movie is not responding to it.

Any ideas?

Thanks a lot.

Stumped: SwLiveConnect Stops Working In New Swf
For some reason swLiveConnect javascript functions work with an old example flash movie but not with my own movie. I'm sure it has to do with my .swf file. I just switch out the path to the .swf in my html and swLiveConnect stops working for my flash movie.

Simple javascript functions like .Play() and .Stop() work fine with an example movie I found online, but my own movie returns a javascript error in firefox debugger: "myFlash.Play is not a function". Does anyone have any suspicion why?

I'm using;

Flash 8.0 professional on Mac OS X 10.4.9. I've tested with Firefox 1.5.0.10 and IE on Windows. Like I said, I'm sure there's some differect in the .swf. Can anyone help me out? Thanks in advance.

jin

Navigation Bar Stops Working After A Few Clicks
the navigation panel for my IT project site, is a pretty simple number (im still getting good with flash). each animation that plays is in its own movieclip and on each button the following code:


ActionScript Code:
on (release) {    getURL("news.html", "content");    if (_root.var_bio == "yes") {        with (_root.bio) {            gotoAndPlay("out");        }        with (_root.news) {            play();        }    }


this stops any animation that is already on display from being played again, this code is repeated so it check through each different clip.

the problem is after only a few click the animations stop playing ? the buttons still open the pages though.

iv been checking everything for ages and dont seem to notice a problem ?

anyhelp would be greatly appreciated

The actual navigation panel is Here

.fla file

Preloader Stops The Scroller From Working
Hi all,

I'm having a strange problem withFflash8.

I have followed the Simple Custom Scroll Bar (http://www.kirupa.com/developer/flash8/scrollbar.htm) tutorial and got it working exactly how I want.

I have also followed "Ultimate Preloader" tutorial (http://www.lukamaras.com/tutorials/p...preloader.html)
and got that working perfectly too.


My webpage loads external SWFs when you click the navigation. On the page where I have the preloader, the preloader works fine. On the pages where I have the scroller, the scroller works fine.

But when I have one page with the preloader AND the scroller on page nothing works. I just get a black page as if the external swf is not even loading, but I know it IS loading as i see the preloader flash for a split second before the screen stays black.

If I remove the preloader, then export and upload the movie, the scroller works perfectly.


This is my code for the preloader:


Code:
stop();
pl_mask._yscale = 1;
var loadingCall:Number = setInterval(preloadSite, 50);
function preloadSite():Void
{
var siteLoaded:Number = _root.getBytesLoaded();
var siteTotal:Number = _root.getBytesTotal();
var percentage:Number = Math.round(siteLoaded/siteTotal*100);
pl_mask._yscale = percentage;
pl_percentageClip.pl_Percentage.text = percentage+"%";
if (siteLoaded>=siteTotal) {
clearInterval(loadingCall);
gotoAndPlay(10);
}
}
The script for the scroller is exactly the same as the tutorial (http://www.kirupa.com/developer/flash8/scrollbar.htm) and it is on frame 10 as are the graphics etc for the scroller.


When I preview (ctrl + enter) it works perfectly with the preloader AND scroller, but when I upload it to my server, it doesn't work.

Can anyone help me out on this?

Many thanks

ActionScript 2.0 Button Stops Working
I have created a movieclip called service1. When you click on a button on the main timeline, the service1 mc pops up. Within the service1 mc is a button that, when pressed, closes the service1 mc window. The code that I have placed on the button is:

on(press){
this._visible = false;
}

When I test the scene the button does exactly what I want it to do, the service1 mc dissapears. Perfect! However, when I test the movie, the service1 mc pops up but the button goes inactive. Can anyone tell me why and how do I fix it?

Combobox Stops Working Hen Loading New Swf
Hi all...

I'm relatively new to flash 8 and am having a problem with a combobox that is driving me nuts.

Basically I have two .swf files...one called 001.swf and one called 002.swf. In both movies I have the same combobox containing the same data (i.e. page1 and page2). For each combobox I have a "on(change)" event which basically gets the selected value and then in an IF statement loads a movie...

on(change){
pageno_cb=this.getValue();
if(pageno_cb=="Page1"){
loadMovie("001.swf",0);
}
if(pageno_cb=="Page2"){
loadMovie("002.swf",0);
}
}

This works as its supposed to and loads the .swf...however, once the new .swf has loaded all comboboxes cease to work (upon clicking, no drop-down value list appears). All other functionality works.

Ive looked around and Ive seen reference to this._lockroot = true;however I cant get it working and Im not sure what exactly to do with it.

If anyone can help I would be eternally grateful.

KeyboardEvent Stops Working In Fullscreen
Hi

I need some help with KeyboardEvent.

First, now I nead to click with the mouse on the stage for the eventlistener to register a keyboard press.

How can I set the focus to the stage at all time?

Second, I am making a videoPlayer. When I enlarge it to fullscreen the KeyboardEvent stops working even if it did work before. Why and how do I fix it?

I'm useing Flex.

Cheers

Scrollbar In Loaded Swf Stops Working.
Hi, sorry if this is a very n00b question but i have a class Scrollbar, which works fine unless I load the swf into another movie.

I get an error on this thing:


PHP Code:



public function Scrollbar():void {
scroller.addEventListener(MouseEvent.MOUSE_DOWN, dragScroll);
stage.addEventListener(MouseEvent.MOUSE_UP, stopScroll);            
stage.addEventListener(MouseEvent.MOUSE_WHEEL,mouseWheelHandler);






This is the error:

PHP Code:



TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at Scrollbar()
    at flash.display::Sprite/constructChildren()
    at flash.display::Sprite()
    at flash.display::MovieClip()
    at sisteprosjekt_fla::MainTimeline()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at sisteprosjekt_fla::Symbol1_1/thumbLoaded() 




Any suggestions would be greatly apreciated!

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