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




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.



KirupaForum > Flash > ActionScript 3.0
Posted on: 05-07-2008, 11:09 AM


View Complete Forum Thread with Replies

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

AddEventListener Not Working On MC
I'm trying to create a small whiteboard and I have a thin framed rectangle as a MovieClip. I want to add mouse event listeners for the drawing.
I tried testing with the following code since nothing was working and I still get nothing (wh_bd is the MC):

Code:
wh_bd.addEventListener(MouseEvent.MOUSE_DOWN,msDown);
function msDown():void
{
trace("down");
}

No trace shows up.
Anyone know what I might be doing wrong? Thanks in advance.

AddEventListener Not Working
This is a simple event handler question. I need to fire an event once an image has finished loading. I've used the following syntax but the loadComplete() function isn't firing. The image loads in fine but the trace doesn't run. I know I'm not off by much but any help would be appreciated. Thanks.


Code:
imageLoader.loadMovie(images[currentPos]);
imageLoader.addEventListener(Event.COMPLETE,loadComplete);

function loadComplete() {
trace("image loaded succesfully");
}

AddEventListener Not Working
Adding event listeners to a loader, and it won't call the function!! here is the code:

it doesn't trace anything... anyone know why? is AS3 still buggy? we have weird problems with it!







Attach Code

var splashScreenReq:URLRequest = new URLRequest("..\" + lessonSettings_array['splashScreen']);
splashScreenLoader = new Loader();

splashScreenLoader.addEventListener(Event.COMPLETE, splashComplete);
splashScreenLoader.addEventListener(ProgressEvent.PROGRESS, splashLoader);
splashScreenLoader.addEventListener(Event.INIT, splashLoader);

splashScreenLoader.load(splashScreenReq);
content_mc.addChild(splashScreenLoader).name = "splash";

var splashScreen = content_mc.getChildByName("splash");

function splashLoader(event:ProgressEvent):void {
trace("Splash Loading");
}

function splashComplete(event:Event):void {
trace("Splash Complete");
}

AddEventListener Not Working
Please help!

I have created a scrolling bar menu. All the buttons in the menu work except for the last two. When I place a trace statement within the function it definitely is listening to all the buttons except for the last two. All instances are named correctly. Can the size of the scroller be contributing to why the addEventListener is not working?

var mouseOverScroller:Boolean = false;
var img:MovieClip;
var scrollerWidth:Number = scrollbar_mc.width;
var stageWidth:Number = stage.stageWidth;
var center:Number = stage.stageWidth/2;

/*Declare variable to calculate how many duplicates are neededThe following calculates 3 instances to be added to the display list*/
var dups:Number = (stageWidth/(2*scrollerWidth))+1;

//i = 1, since one instance is already on the stage
for (var i:uint = 1; i < dups; i++) {
var rightDup:uint = 2*i; var leftDup:uint = (2*i)+1;
var right:scroll_buttons = new scroll_buttons();

// position the mc to the right
right.x = scrollbar_mc.scroll_buttons_mc.x + i * scrollerWidth; scrollbar_mc.addChild(right);

var left:scroll_buttons = new scroll_buttons();

//position the mc to the left
left.x = scrollbar_mc.scroll_buttons_mc.x - i * scrollerWidth;
scrollbar_mc.addChild(left);}

stage.addEventListener(Event.ENTER_FRAME, onEnter);
scrollbar_mc.addEventListener(MouseEvent.MOUSE_OVE R, onOver);
scrollbar_mc.addEventListener(MouseEvent.MOUSE_OUT , onOut);

function onOver(event:MouseEvent):void
{ mouseOverScroller = true;}

function onOut(event:MouseEvent):void
{ mouseOverScroller = false;}

function onEnter(event:Event):void
{ if (mouseOverScroller) {
scrollbar_mc.x += (center-stage.mouseX)*.01;
}

if (scrollbar_mc.x>center+(scrollerWidth/2)) {
scrollbar_mc.x -= scrollerWidth;
} else if (scrollbar_mc.x<center-(scrollerWidth/2)) {
scrollbar_mc.x += scrollerWidth;
}
}

scrollbar_mc.scroll_buttons_mc.bathroom1_btn.addEv entListener(MouseEvent.CLICK, onClick);
scrollbar_mc.scroll_buttons_mc.bathroom2_btn.addEv entListener(MouseEvent.CLICK, onClick);
scrollbar_mc.scroll_buttons_mc.bedroom1_btn.addEve ntListener(MouseEvent.CLICK, onClick);
scrollbar_mc.scroll_buttons_mc.bedroom2_btn.addEve ntListener(MouseEvent.CLICK, onClick);
scrollbar_mc.scroll_buttons_mc.kitchen1_btn.addEve ntListener(MouseEvent.CLICK, onClick);
scrollbar_mc.scroll_buttons_mc.kitchen2_btn.addEve ntListener(MouseEvent.CLICK, onClick);
scrollbar_mc.scroll_buttons_mc.livingroom1_btn.add EventListener(MouseEvent.CLICK, onClick);
scrollbar_mc.scroll_buttons_mc.livingroom2_btn.add EventListener(MouseEvent.CLICK, onClick);

function onClick(event:MouseEvent):void
{ if (event.target == scrollbar_mc.scroll_buttons_mc.bathroom1_btn) {
img = new bathroom1();
trace (event.target.name);
} else if (event.target == scrollbar_mc.scroll_buttons_mc.bathroom2_btn) {
img = new bathroom2();
trace (event.target.name);
} else if (event.target == scrollbar_mc.scroll_buttons_mc.bedroom1_btn) {
img = new bedroom1();
trace (event.target.name);
} else if (event.target == scrollbar_mc.scroll_buttons_mc.bedroom2_btn) {
img = new bedroom2();
trace (event.target.name);
} else if (event.target == scrollbar_mc.scroll_buttons_mc.kitchen1_btn) {
img = new kitchen1();
trace (event.target.name);
} else if (event.target == scrollbar_mc.scroll_buttons_mc.kitchen2_btn) {
img = new kitchen2();
trace (event.target.name);
} else if (event.target == scrollbar_mc.scroll_buttons_mc.livingroom1_btn) {
img = new livingroom1();
trace (event.target.name);
} else if (event.target == scrollbar_mc.scroll_buttons_mc.livingroom2_btn) {
img = new livingroom2();
trace (event.target.name); }

imageContainer_mc.addChild(img);
}

AddEventListener Not Working...weird Case
ActionScript Code:
private function onLoadFrameInit(mcTarget:MovieClip):Void
{
    var gFrame:GenericFrame;
   
    if (mcTarget.__proto__ != GenericFrame.prototype)
    {
        mcTarget.__proto__ = GenericFrame.prototype;
        GenericFrame["apply"](this, []);
        gFrame = GenericFrame(mcTarget);
        gFrame.addEventListener("onCallFunction", Delegate.create(this, callNetFunction));
    }
}

This is an event handler for the MovieClipLoader's onLoadInit event. I'm dynamically casting the loaded swf as a GenericFrame so I can start listening to it's events. I know the cast works as I can call properties on gFrame that are GenericFrame specific. I'm positive the event is being fired from the other side, so why wouldn't this class receive the event object?

Mouse Click AddEventListener Not Working
hi, i have a MovieClip instance on stage named "myBtn"

i just want it to execute a function when pressed

i tried to add a MouseEvent listener to it, however its not working. the code looks logically correct. and it works when i use ROLL_OVER etc...
but doesn't work when i use CLICK.

am i doing it wrong?


Code:

myBtn.addEventListener(MouseEvent.CLICK, myFunc);

function myFunc(curEvt:MouseEvent) {

trace("btn pressed");

}

AddEventListener To MouseEvent.Roll_Over Not Working
Alright, so I'm an intermediate with flash but really new to AS 3.0. I've recently started using Flash 9 with CS3 and am having a bear of a time with this one small issue.
Here is the file in use
http://www.cyan-studios.net/hpe2/

It's the left side of the header. So far, I've only made the first drop down menu, under "about us" work. Sort of. If you hover over "Locations", the flyout menu appears. Then if you hover over "Clients", that flyout then appears. Now try going back to the "Locations" button. No flyout.

The drop down from "About Us" is a movie clip called "About us" and it appears in frame 2 of the main scene. Clicking or hovering over the "About Us" button drives us over to frame 2. Not an issue there.

In the "About Us" movie clip, we have a similar setup. Frame 2 shows the flyout menu from locations. Frame 3 shows the flyout menu for "Clients". Frame two is labeled "locationstier2" and frame three is "clientstier2" in this movie clip.

My issue is, why doesn't the flyout reappear next to "Locations" after you've moved on to "Clients" unless you reset it by mousing away?

Here is the action script on the top layer as it spans across the three frames.


Code:
locationsclick.addEventListener(MouseEvent.MOUSE_OVER,locationsover);
clientsclick.addEventListener(MouseEvent.MOUSE_OVER,clientsover);
function locationsover(event:MouseEvent): void {
gotoAndPlay("locationstier2");
}
function clientsover(event:MouseEvent):void {
gotoAndPlay("clientstier2");
}

AddEventListener / ComboBox - Not Working Programmatically
Hi,

I have a comboBox with an EventListener:

ActionScript Code:
rhythmTypeListener = new Object();rhythmTypeListener.change = function(evt) {    trace(&#8220;run code”);}rhythmType_Combo.addEventListener("change", rhythmTypeListener);

All of this works until I select the comboBox’s index programmatically;


ActionScript Code:
rhythmType_Combo.selectedIndex = 6;


The comboBox changes to the approrite text but the EventListener is never called.

Why is this, and is there a way?

Strange AddEventListener (not Working When Default Parameters Were Given)
stage.addEventListener(Event.RESIZE, resizeHandler,false,0,true)

This is not working but if I removed those parameters, it's okay

stage.addEventListener(Event.RESIZE, resizeHandler);

I am really puzzled why the default parameters must be hidden to make it works correctly... Really strange!

MovieClip_mc.addEventListener(KeyboardEvent.KEY_DO WN,onKeyDown) Not Working.
ActionScript Code:
MovieClip_mc.addEventListener(KeyboardEvent.KEY_DOWN,onKeyDown);

function onKeyDown(event:KeyboardEvent):void
{
    trace ("Hello");
}
This is placed in the first frame, it's not working.
The funny thing is if I were to replace KeyboardEvent.KEY_DOWN with MouseEvent stuff it works, but it doesn't seems to respond to KeyboardEvents.

Anyone ?

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::::::::-

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

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.

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;
}
}

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!

I´m very impressed about an error that occured over here.

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

it´s placed in the default path where flash comm server is installed:

C:Arquivos de programasMacromediaFlash Communication Server MXapplications

that´s it.

but I´ve 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, It´s 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.

I’ve looked around and I’ve seen reference to this._lockroot = true;…however I can’t get it working and I’m 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

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