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




Function() Not Functioning



Hi,
When I try to call function from MC by using on(release) it doesn't work. Why?

Ex:
function navi(){
trace(_currentframe);
}

//========Calling from MC======
on(release){
navi();
}
//=======doesn't work=========


//========Calling from button object======
on(release){
navi();
}
//======it work=====================


WHY?



SitePoint > Design Your Site > Flash and Actionscript
Posted on: Jan 16, 2004, 22:54


View Complete Forum Thread with Replies

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

My Function Isn't Functioning/Actionscript To Call A Function Flash MX 2004
Hello,

Well in theory I know how to create a function but for some reason I am unable to call it.

Can someone take a look at it and tell me what went wrong. Basically when I go to "a certain page" I want to click on a button and have it go to another page known as "pics" it then will load a jpeg there known as jpeg loader. Now I know it works properly without a functin, but because I am lazy I do not want to write more code than I have to, there are like 300 differnt jpegs I have to load. Thus I need to create a function.

here is my AS


ActionScript Code:
//this is on frame one of my root timeline
//I am trying to call the function "display" on release of my button
 
omnihotelButton.onRelease = display ("J010 Omni Hotel.jpg");
 
 
//this is my function that I set up it is also on my root, but on a different frame
//this function is named display and it goes to the "pics" page and stops
where it then loads a jpeg which is et up as my variable.
//the xscale and the yscale are just setting up my size of the jpeg.
 
function display(jpeg){
    _root.gotoAndStop("pics");
    jpegLoad_mc.loadMovie(jpeg);
    jpegLoad_mc._xscale=90;
    jpegLoad_mc._yscale=90;
}

Function Not Functioning Fully...
PLEEEEASE - can anybody help??

I have a function which works fine, but now I want to add something to it. In addition to the colour change on rollOver, I want it to play a movie - sounds simple enough, but for the life of me, I can't make it work. I figure it's something silly, but what??? I've tried it every which way, but haven't stumbeled upon the answer yet - so thought it's time to ask the experts...

The following code works fine on a test button - just so you can see where things are...

on (rollOver) {
_level0.all.pulseMC.pulseMC1.play("play");
}


Here is the global function, the bits in red are my new additions:

_global.subControl = function(mc,mc2){
mc.onRollOver = function() {
mc.colorTo ("0x00CC00", 0.5, "easeOutExpo");
_level0.all.pulseMC.mc2.gotoAndPlay("play");
};
mc.onRollOut = function() {
mc.colorTo ("0xCCCCCC", 0.5, "easeOutExpo");
}
};

Here is the call to action:
_level0.all.content.subMenu.btn2.onEnterframe =
function() {
subControl(this,pulseMC1)
};

mc2 represents the movieclip name - there are 3, unsurprisingly numbered 1-3. I am only testing with pulseMC1 at the moment.

I've written it in various ways and just can't make it work What am I doing wrong??? Can anyone help?? I'd be very grateful

Many thanks in advance!!!

LoadVars - Put It In A Function And It Stops Functioning?
hi,

this works


PHP Code:




myData = new LoadVars();
    myData.onLoad = function() {
        helptext.text = this.content;
    };
    myData.load("Help.txt");







but if i put it inside a function eg


PHP Code:




function loadhelp() {
    myData = new LoadVars();
    myData.onLoad = function() {
        helptext.text = this.content;
    };
    myData.load("Help.txt");







and call the function eg


PHP Code:




loadhelp();







it doesn't work anymore

any ideas?

thanks

Functioning Grid
I posted this before, but got no answer. Maybe some more info is in order.

I've been unable to find any tutorials or info regarding the use of a grid. I want to define a grid not unlike one in a chess game. I want to be able to move pieces around (and ultimately save their position). However, I have no idea how to define such a grid in Actionscript. The best example I have is a connect four game I d/led as an example. The following code defines the game grid...

// connect4 jim burton mar 2002 j.b@dynamitechicken.com
// initialise the array of places on the board
// Define 2D array object of the form places[row][column]
// with properties
// x: positions x pos
// y: place's y pos
// state: (empty, red, yellow) the status of each
places = new Array(7);
for (var r = 0; r<7; r++) {
// new row
places[r] = new Array(7)
for (var k = 0; k<7; k++) {
// new column
places[r][k] = new Object()
places[r][k].x = 65+(k*50)
places[r][k].y = 85+(r*50)
places[r][k].state = "empty"
}
}
emptySpaces = 49


its pretty apparent how the Array and For loops work to create the the rows and columns. What part confuses me is "places [r][k] = 65+(k*50)" and the other line below it. Exactly what does this do?

If anyone can explain this to me, or show me a better way to establish a grid, I'd be most grateful.

Flash Not Functioning On The Mac
Pardon me if this has been explained before, but I have a site that's been tested in IE and NN down to the 4.0 level and works fine on the PC. However, on the Mac it seems to work only erratically. Some can use it with IE5, others can't.

I'm using a preloader and a passive sniffer to detect a flash 5.0 player. The site does use flash 6.0 (need a sniffer for that)

The URL is http://www.minneapolisroads.com

If anyone has an idea of what's going on please do give me a shout.

This.onLoad = Functioning?
I just discovered, and really like putting

this.onEnterFrame = function(){
MakeMagic("now");
}

on the 1st frame of a MC. Much better than onClipEvent(enterFrame){ on the outside of the MC when you have lots of duplicates of the MC, and want to make changes to all of them. yeah.

but, this.onLoad = function(){ isn't working for me like an onClipEvent(load){ should. waa.

?

[CS3] Functions Not Functioning
Can any one tell me why this don't work?

function buttonAction(buttonName:MovieClip, buttonMove:String) {
buttnName.gotoAndStop(buttonMove);
}

aboutButton.onRollOver = function() {
buttonAction(aboutButton, over);
};


Thanks

RSB

NetDebug Not Functioning
I'm trying to get one of the packaged tutorials running on our FLASH COMM SERVER, "tutorial_hello".

Initially, when testing I couldn't get anything to function because I received an error message due to the inclusion of the "#include netDebug.as". I received an error indicating the script could not be found (using V8 Pro).

I decided to comment out the include request to see how the swf would behave...well...I can connect to the server ("Net Connection success") but do not receive anything back from the server.

So, now I'm back to debugging. After reading a number of threads from others who have experienced what I'm currently going through, I found info suggesting the download of the newest version of the "FLASH REMOTING COMPONENTS". After doing so, I still get the error message. On a fluke, I decided to see if the components installed - no luck.

I've since found a Macradobia tech note explaining that V8 does not install with these tools for some reason. As a work around I have decompiled the exe containing these scripts and attempted to place them mannually in the proper directory. Still no success

ANYONE HAVE A CLUE HOW TO GET THESE TOOLS TO FUNCTION?

THANKS!

AttachMovie Not Functioning?
I am trying to write a script that attaches a loading bar when the clipListener does onLoadInit. For some reason the attachMovie action I have added does not work but the code looks correct to me.

Is there some kind of error with my code here?


Code:
Stage.align = "LT"
Stage.scaleMode = "noScale"

var clipListener:Object = new Object();
var clipLoader:MovieClipLoader = new MovieClipLoader();

clipLoader.loadClip("port.swf", this.contentMC)
clipLoader.addListener(clipListener)

clipListener.onLoadInit = function(target_mc:MovieClip){
var loadingmc:MovieClip = this.createEmptyMovieClip("loadingmc", this.getNextHighestDepth())
loadingmc.attachMovie("loader", "loadermc", 1)
loadingmc._x = 425
loadingmc._y = 325
}

clipListener.onLoadProgress = function(imageClip:MovieClip, loaded:Number, total:Number){
percent = (loaded/total)*100
var percentText:Number = Math.round(percent)
//trace(percent)
}

clipListener.onLoadComplete = function(imageClip:MovieClip){
//removeMovieClip(loadingmc)
}

Functioning .swf And No .html
I've just completed writing a sizeable program in Flash. When I publish it, I end up with an .swf file that's pretty much perfect - and an .html file that does virtually nothing at all.

The program uses a simple graphical interface to display text loaded in as xml data to the user.

If I publish using the default settings, I end up with the graphical interface visible - but none of the xml loads. If I override the default with a manually coded <param name="base"> tag to specify the absolute filepath, I end up with a file and xml which is visible on my home computer, but which disappears entirely (including the graphical interface) when I attempt to view it over the web.

I know this sounds like a security problem - but the xml files are actually stored in the same folder as the .swf and .html files themselves, so it's not a question of cross-domain problems...

Has anyone run into anything like this?

Frames Not Functioning On A Mac.
Hey guys,

so, really basic layout; been done a million times; top frame = flash navigation, bottom frame = html content.

I understand the basic concept of:


ActionScript Code:
on (release) {
    getURL("home.html", "dynamic");
}


"dynamic" being the name of my lower frame. All is great on a PC, but when tested on a Mac, all of the links are dead.

Any ideas? I've browsed the site forever and have come close to answers, but not quite there yet. Any suggestions would be amazing.

http://www.audioproinc.com/dev

Combo Box Not Functioning
Hello. I'm loading a flash movie (2.swf) into a main flash container movie(main.swf). 2.swf has a combo box component that works fine independently, but when loaded into the main.swf the combo box is not functional. Is this normal combo box behavior or is there a glitch within flash? I need this combo box to work being loaded into the main.swf movie.
Thanks!

Swf Functioning Very Very Very Slow
Hi
i`m building a site that loads external swf. after i built it i started to work on the external swf. after one was finished i managed to load it, and all seem well.
a week and a half has past and i wanted to load other swfs i created. but (before i did anything) the site it self is functioning very very slowly.
i checked the size: 52.0 KB.

does anybody has any idea? or had the same problem? the only difference is the passing time, but this is aging on drugs:)

best regards

ron

Buttons Not Functioning~
I had the buttoms working but as soon as i converted them into movie clips to spice them up they don't seem to excecute the button anymore, im using the code from voetsjoba tutorial transitions between external swf's

can anyone help me out with this???

the links is www.a2-media.cjb.net

Thanks!

Site Not Functioning In IE?
I need some help!

I built this site about a year ago for a photographer. I am on a Mac, and she just recently started complaining that the site doesnt work on her PC. She says that after the home page, and page that she goes to gives her an error message? I dont have a PC to look at. Could it be something with IE7 and my Flash detection script? Any help would be GREATLY appreciated.

Cameron

http://duluthphotographer.com/

http://duluthphotographer.com/weddings.html

For Loops Not Functioning How I Want It - Help Plz
ActionScript Code:
var cityArray:Array = new Array();cityArray[0] = "southland";cityArray[1] = "otago";cityArray[2] = "westland";cityArray[3] = "sthCanterbury";cityArray[4] = "nthCanterbury";cityArray[5] = "buller";cityArray[6] = "marlborough";cityArray[7] = "nelson";cityArray[8] = "wellington";cityArray[9] = "manawatu";cityArray[10] = "hawkesbay";cityArray[11] = "taranaki";cityArray[12] = "eastCoast";cityArray[13] = "centralNorth";cityArray[14] = "bop";cityArray[15] = "waikato";cityArray[16] = "auckland";cityArray[17] = "northland";var startNumber:Number = 0;for (var createLinks:Number = 0; createLinks<cityArray.length; createLinks++) {    _root.nzmap_mc[cityArray[createLinks]+"_mc"].onRelease = function() {        var thisNumber:Number = _root.startNumber;        trace(thisNumber);        //Play Animation        //_root.nthCanterbury.play();        //Disable Map        //mapEnable(false);        //Fade Map        //fadeOut(nzmap_mc);    };    _root.startNumber++;}


What have I done wrong? I'm trying to give each mc it's own number based on the name position in the array etc etc - It returns 18 for all of them when I click them one at a time.

Please Help

RemoveMovieClip Not Functioning
I am have problems with the removeMovieClip() function;

I have tried several methods to get the function to work. see below


Code:

newThis.removeMovieClip();
newThis.unloadMovie();
unloadMovie(newThis);
newThis.unloadMovie;
removeMovieClip(newThis._parent["bullet_mc"+nStoredLocation]);
none of them seemed even remotely effective.
I created the movieclip dynamically so the removeMovieClip function should work.

Below is the code for my Movie Clip


Code:
//seperates this movieclip from the parent from which it is duplicated from (now bRequestRotation)
//var bBulletActive:Boolean = new Boolean(false);
//dynamically changes the bullet velocity.(not in use)
//var nBulletVelocity:Number = new Number(5);
//a number that is set by the parent mc.
var nBulletAngle:Number;
//starting value for the timer
var nTimer:Number = new Number(0);
//timer function based on 12fps about a sec.
var nTimerMax:Number = new Number(15);
var newThis = this;
//stores the movieclips number which is also the clip's depth
var nStoredLocation;
//boolean which is activated by a parent movieclip
var bRequestRotation;

function fRequestRotation()
{
//trace("fRequestRotation Running")
//trace("Bullet: "+ newThis);
if(bRequestRotation == true)
{
//mathematical function run for the duration(AKA, the bullets movement)
if(nTimer<nTimerMax)
{ //converts degrees to radians which is handled by flash
nBulletRadian =(nBulletAngle/180)*Math.PI;
//calculates the speed
dy=(15*Math.sin(nBulletRadian));
dx=(15*Math.cos(nBulletRadian));

//pointer to this clip; moves it horizontally and vertically
newThis._x+=dx;
newThis._y+=dy;

//["bullet_mc"+nStoredLocation]
//trace("dx: "+dx +" Loaction X: "+this._x);
//trace("dy: "+dy+" Loaction Y: "+this._y);
//progresses the timer variable
nTimer++;
}

if(nTimer>nTimerMax)
{
//removes this interval
clearInterval(iRequestRotation);

//removes movieclip
newThis.removeMovieClip();
newThis.unloadMovie();
unloadMovie(newThis);
newThis.unloadMovie;
//trace("Location: "+newThis._parent["bullet_mc"+nStoredLocation])
removeMovieClip(newThis._parent["bullet_mc"+nStoredLocation]);

//setTimeout an undocument Function calls the function once after a time delay
//setTimeout(fUnloader,1000);

trace("Movie Unloaded");
}
trace(newThis);
}
}
//sets an interval that is activated on startup
var iRequestRotation = setInterval(fRequestRotation, 1000 / 12);
i've tried everything i can think of any help at all would be greatly appreciated.

[AS 2.0] RemoveMovieClip Not Functioning
I am have problems with the removeMovieClip() function;

I have tried several methods to get the function to work. see below


Code:
newThis.removeMovieClip();
newThis.unloadMovie();
unloadMovie(newThis);
newThis.unloadMovie;
removeMovieClip(newThis._parent["bullet_mc"+nStoredLocation]);
none of them seemed even remotely effective.
I created the movieclip dynamically so the removeMovieClip function should work.

Below is the code for my Movie Clip

**THERE WAS A BUG I EDITED THIS CODE POST**

Code:
//seperates this movieclip from the parent from which it is duplicated from (now bRequestRotation)
//var bBulletActive:Boolean = new Boolean(false);
//dynamically changes the bullet velocity.(not in use)
//var nBulletVelocity:Number = new Number(5);
//a number that is set by the parent mc.
var nBulletAngle : Number;
//starting value for the timer
var nTimer : Number = new Number (0);
//timer function based on 12fps about a sec.
var nTimerMax : Number = new Number (15);
var newThis = this;
//stores the movieclips number which is also the clip's depth
var nStoredLocation;
//boolean which is activated by a parent movieclip
var bRequestRotation;
function fRequestRotation ()
{
//trace("fRequestRotation Running")
//trace("Bullet: "+ newThis);
if (bRequestRotation == true)
{
//mathematical function run for the duration(AKA, the bullets movement)
if (nTimer < nTimerMax)
{
//converts degrees to radians which is handled by flash
nBulletRadian = (nBulletAngle / 180) * Math.PI;
//calculates the speed
dy = (15 * Math.sin (nBulletRadian));
dx = (15 * Math.cos (nBulletRadian));
//pointer to this clip; moves it horizontally and vertically
newThis._x += dx;
newThis._y += dy;
//["bullet_mc"+nStoredLocation]
//trace("dx: "+dx +" Loaction X: "+this._x);
//trace("dy: "+dy+" Loaction Y: "+this._y);
//progresses the timer variable
nTimer ++;


if(nTimer>nTimerMax)
{ //removes this interval
clearInterval(iRequestRotation);

//removes movieclip
newThis.removeMovieClip();
newThis.unloadMovie();
unloadMovie(newThis);
newThis.unloadMovie;
//trace("Location: "+newThis._parent["bullet_mc"+nStoredLocation])
removeMovieClip(newThis._parent["bullet_mc"+nStoredLocation]);

//setTimeout an undocument Function calls the function once after a time delay
//setTimeout(fUnloader,1000);

trace("Movie Unloaded");
}
trace(newThis);
}
}
//sets an interval that is activated on startup
var iRequestRotation = setInterval(fRequestRotation, 1000 / 12);
i've tried everything i can think of any help at all would be greatly appreciated.

AS Not Functioning In Buttons
I'm following this tutorial link . I got to about page 5 when the codes provided stopped working for me. If you look at the finished site, there's an animation for each button and the animation is detailed in the actionscript. However, I only get the "opening" animation, where all of the buttons fly into the center so that they are clickable. None of the other buttons seem to work. If you can offer any advice on how to get those navigation animations working, I'd be wonderfully pleased. I have all of the given codes in the proper places, so I'm not sure what could cause the issue. I can provide any other information that you need, as well as my .fla files. Thank you for helping with my first flash site.

Buttons Not Functioning~
I had the buttoms working but as soon as i converted them into movie clips to spice them up they don't seem to excecute the button anymore, im using the code from voetsjoba tutorial transitions between external swf's

can anyone help me out with this???

the links is www.a2-media.cjb.net

Thanks!

Calculation Not Functioning
Hey. . I am trying to get a simple calculation going in flash....

I have created an input text box (variable name: ageVAR) and a dynamic text box (variable name: LuckyNumVAR) on the first frame of the same layer. Also there I have put a button and in the 'action button' section my code is:


Actionscript Code:
on (release) {    LuckyNumVAR = Number (ageVAR) + 2;}

however when I test the movie, rather than doing the calculation it reads
Quote:




NaN




in the dynamic text box. I cannot figure out why - does anyone have any ideas>?

OnLoad Not Functioning
i've got a tween that is supposed to occur right when the movie clip loads. If i call it with an onRelase it works...but when i call it with onLoad it just sits there...what am i doing wrong?

ActionScript Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
box_mc.onLoad = function(){
myMoving(box_mc)}
myMoving = function (anything) {
    var myMove:Tween = new Tween(what, "_x", Strong.easeIn, 320, 100, .8, true);
};

My Button Is Not Functioning .. What's Wrong With Me ..?
ok here's the situation ..

i have a mainpage.swf with several other files links to it ..
every files have its own BACK button to allow the user to go back to the mainpage.swf ..
on the mainpage.swf, i embedded a looping sound to play continuously ..

my problem is ..
my BACK button is not functioning everytime i click it to go back to the mainpage.swf ..
does it because of the level i used on the actionscript ..

fyi, on the mainpage.swf .. i used this :

on (release) {
loadMovieNum("one.swf", 0);
}

to link the mainpage.swf to one.swf file ..


on the BACK button, i used :

on (release) {
loadMovieNum("mainpage.swf", 4);
}


for the sound played, i called it from external swf which is :

on (release) {
loadMovieNum("soundtrack.swf", 20);
}

pls help to clarufy my problem ..

Preloader Not Functioning As Expexted
Hi again,

already posted this but the replies didn't work out for me. I've tried numerous approaches but none did the job.

Thingy is, I got a big swf file with lots of symbols(which are ALWAYS loaded in the first frame), so I can't put the preloader into the first two frames of my swf since it just doesn't load before the main movie. Same with different scenes within one movie.

Therefore I tried flashbax approach.
Created a separate preloader.swf with two frames. Within these two frames some small movies are displayed to show the connection is still downloading.

Actionscript for first frame:

_root.createEmptyMovieClip("wachstum", 1);
_root.wachstum.loadMovie("wachstum.swf");

if (_root.wachstum.getBytesLoaded() >= _root.wachstum.getBytesTotal());
{
_root.loadMovie("wachstum.swf");
}

Actionscript second frame:

gotoAndPlay(1);

Problems: Everytime I upload this on the server and load the site via web, there is just blank white space and the "wachstum.swf" doesn't load as expected.
If I trace _root.wachstum.getBytesLoaded() and _root.wachstum.getBytesTotal()) Flash MX returns 0 for both, which can't be true, at least for the second one.

If anyone can provide a working fla sample file I would be grateful
. I have been laborating with this bugger for two weeks now. And please don't point me to one of those preloader tutorials, the ones I've seen are not oriented practically since none of these has as much symbols as the average real life file.

Thanks for reading.

Preloader Not Functioning Correctly
hi my preloader doesnt seem to be working but i dont really know why

check it out here!

http://www.liquidfists.com/portfolio/

and here is the code on the preloader page!

code:
stop()
msg = "main content loaded";

nFrame = function(){
_root.nextFrame()
}
fadeAlpha2 = function(){
this._alpha = Math.round(getPercent*100);
if(this._alpha == 100){
_root.wLoaded.text = msg;
setInterval(nFrame,5000)
delete (this.onEnterFrame);
if(_root._currentframe == 2){
clearInterval(nFrame,5000);

}
}
}
for (i=0; i<50;++i){
_root["square"+i]._alpha = Math.round(0);
_root["square"+i].speed = Math.round(5);
_root["square"+i].onEnterFrame = fadeAlpha2;
}
bytes_loaded = Math.round(getBytesLoaded());
bytes_total = Math.round(getBytesTotal());
getPercent = bytes_loaded/bytes_total;
loadedBytes = bytes_total-bytes_loaded;
_root.loadBar._xscale = Math.round(getPercent*100);
_root.pText.text = Math.round(getPercent*100);
_root.pText.autoSize = true;
_root.wLoaded.autoSize = true;
_root.pText._x = Math.round(getPercent*525)


can anyone see what could be stopping the file from preloading?
thanx for ur help in advance!

OnEnterFrame Is Not Functioning As Expected
I have been trying to figure out what is wrong with this code that's on frame 1 of the main timeline since yesterday =>
code:
loader_mc.onEnterFrame = function(){
var loadedPercent = Math.ceil(_parent.getBytesLoaded()*100/_parent.getBytesTotal());
trace("Percent loaded => "+loadedPercent);
//Continue to load movie and move loader_mc frame according to percent loaded
this.gotoAndStop(loadedPercent);
//SWF has completed loading, fade preloader out and move playhead to "main"
if(loadedPercent >= 100){
trace("Loading completed...");
_parent.gotoAndStop("transition");
delete this.onEnterFrame;
}
}


in my movie, i have a 100 frame preloader and the preloader instance(loader_mc) is supposed to play its corresponding frames while the main movie is loading. After loading has completed, the main timeline is supposed to go to the frame labeled "transition".

However, what's happening now is that the preloader "supposedly" plays through its 100 frame sequence and goes straight to the last frame (frame 5) where all the content are. The traces are also not showing up at all...

If the FLA is required to get a better understanding of the problem, i'll gladly provide it.

thanks

Secondary Menu Not Functioning...
I have a movie clip that consists of 5 buttons at the start of the time line. If one of the buttons is hovered over it does at gotoAndPlay to active 3 more buttons.

The code below has been striped to show only the Processes button for simplicity. When I hover over processes, it does display the Processes submenu in the timeline, but none of the Sub Menu events seem to fire off.

The hand cursor does not show up when you go over the submenu items.

You can see the actual swf "Not Work" at acuform.johnswidorski.com.

Thanks, John


Code:
stop();

// trace("-" + _root.NextMenu + "-" + _root.CurrentMenu + "-");


btnProcesses.onRelease = function()
{
_root.CurrentMenu = "Processes";
_root.NextMenu = "";
_root.gotoAndPlay('Processes');
}
btnProcesses.onRollOut = function() {
_root.NextMenu = "";
gotoAndPlay('Processes');
};
btnProcesses.onRollOver = function() {
if (_root.CurrentMenu != "Processes") {
_root.NextMenu = "Processes";
gotoAndPlay('Processess');
}
};


//=================================
// Processes SubMenu Events
//=================================
btnSpinning.onRelease = function() {
_root.CurrentMenu = "Spinning";
_root.NextMenu = "";
_root.gotoAndPlay('Spinning')
};
btnMachining.onRelease = function(){
_root.CurrentMenu = "Machining";
_root.NextMenu = "";
_root.gotoAndPlay('Machining');
};
btnRoundBlanks.onRelease = function(){
_root.CurrentMenu = "Round Blank Production";
_root.NextMenu = "";
_root.gotoAndPlay('Blanks');
};

btnSpinning.onRollOut = function() {
_root.NextMenu = "";
};
btnMachining.onRollOut = function() {
_root.NextMenu = "";
};
btnRoundBlanks.onRollOut = function() {
_root.NextMenu = "";
};

btnSpinning.onRollOver = function() {
if (_root.CurrentMenu != "Spinning") {
_root.NextMenu = "Spinning";
}
};
btnMachining.onRollOver = function() {
if (_root.CurrentMenu != "Machining") {
_root.NextMenu = "Machining";
}
};
btnRoundBlanks.onRollOver = function() {
if (_root.CurrentMenu != "Round Blank Production") {
_root.NextMenu = "Round Blank Production";
}
};

[F8] GotoAndStop() Not Functioning Properly
I have a flash project where there is an introduction scene, followed by a scene which contains a simple quiz. On the quiz scene, there is a question, an input box to type the answer, a Submit button to check correctness, and a Next button, to go to the next frame which contains the next question.

On the Next button, I have the following code:


PHP Code:



on(release){
    if(correct){
        gotoAndStop(2);
    }
}




This should take me to frame 2, which contains question 2 of the quiz. However when I test this out... it does not take me to frame 2.. it takes me to the last frame of the scene and stops, wherever the last frame is.. if there are 8 frames, it will goto and stop on frame 8. I have no idea why it is doing this. I have also tried using:


PHP Code:



gotoAndStop("quiz", 2);




Since the name of the scene is "quiz", but this does the exact same thing. I cannot use _root.gotoAndStop(2) because that will stop it on frame 2 of the previous introduction scene... does anyone have any idea why this would be happening?

Stop Functions Functioning
I want a set of functions to apply ONLY when a MovieClip is on frame 1.
If the MovieClip is on frame 2, I want to functions to stop functioning.

Here is my fla and I have no idea why what I have doesn't work!

Any help would be greatly appreciated!

thanks again guys

here's the code:


ActionScript Code:
onEnterFrame= function(){
    if(toggler._currentframe==1){
        controller.onRollOver=function(){
            over=1
        }
        controller.onRollOut=function(){
            over=0
        }
        controller.onEnterFrame= function(){
            if(over && controller._alpha<100){
                controller._alpha += 10
            }else if(!controller.over && controller._alpha>40){
                controller._alpha -=5
            }
        }
        controller.onPress=function(){
            toggler.gotoAndStop(2)
        }
    }
}

ClearInterval Not Functioning Properly Help
Hey all,

The problem I'm having is with fading my movieclip in and clearing it with clearInterval.
When I load my xml file my output box displays text from my xml file and the movieclip is suppose to fadeout showing my text, it does, then fade back in hiding my text, it does.
The problem is it doesn't clear and the movieclip suddenly disappears, showing the text, then fades back in again, hidding the text. Over and over and over!
I need it to clear so that I could set it up to loop to the next childNode and repeat the process.

I hope I'm making sense!

Could anyone help me on this topic!

AS code:

PHP Code:



load_xml = new XML();
load_xml.ignoreWhite = true;
load_xml.onLoad = function(success)
{
if (success)
{
process(load_xml);
}else{trace("Something is wrong, we're not opening!");}
};
//Load up the XML file into Flash
load_xml.load('images.xml');
//---Function that will be called when xml loads succesfully
//xmlDoc_xml is now a reference to the XML object where our information is stored

item_arr = new Array("img", "startdate", "enddate", "url");


function process(xmlDoc_xml)
{
for (var n = 0; n < xmlDoc_xml.firstChild.childNodes.length; n++)
{
if (xmlDoc_xml.firstChild.childNodes[n].nodeName == "promo")
{
for (var i = 0; i < xmlDoc_xml.firstChild.childNodes[n].childNodes.length; i++)
{
if (xmlDoc_xml.firstChild.childNodes[n].childNodes[i].nodeName == item_arr[i])
{

trace(xmlDoc_xml.firstChild.childNodes[n].childNodes[i].firstChild.nodeValue);

}

}
trace("Is it working " +xmlDoc_xml.firstChild.childNodes[0].childNodes[0].firstChild);
output=xmlDoc_xml.firstChild.childNodes[0].childNodes[0].firstChild;

}
//trace("Come to poppa " +xmlDoc_xml.firstChild.childNodes[n].childNodes[0].childNodes.length);
}

}
MovieClip.prototype.fade = function (endAlpha, speed) {
    trace("called11");
        if(this._alpha > endAlpha) speed *= -1;
        this.onEnterFrame = function () {
                if (Math.abs(endAlpha - this._alpha) > Math.abs(speed)) {
                        this._alpha += speed;
                        myInterval = setInterval(beginFadeOut,time());
                        this.clearInterval(myInterval);
                } else {
                        this._alpha = endAlpha;
                        
                }
        }
}
MovieClip.prototype.fadeIn = function(begalpha,speed){
    trace("called22");
    this._alpha=0;
    if(this._alpha<begalpha) speed *= -1;
    this.onEnterFrame=function(){
        if(Math.abs(begalpha-this._alpha)>Math.abs(speed)){
            this._alpha -= speed;
        }else{
            this._alpha=begalpha;
            
                        
            
        }
    }
}
mc.fade(0,7);
function beginFadeOut() {
        mc.fadeIn(100, 7);
        
}
function time(){
    sec = ((30/5)*1000);
    trace("seconds called");
    return sec;





Anyone's help is greatly appreciated!


cbs

OnEnterFrame Is Not Functioning As Expected
I have been trying to figure out what is wrong with this code that's on frame 1 of the main timeline since yesterday =>


ActionScript Code:
loader_mc.onEnterFrame = function(){
    loaded = Math.round(getBytesLoaded() / 1024);
    total = Math.round(getBytesTotal() / 1024);
    percent = Math.round((loaded/total) * 100);
    //_global.loadedPercent += Math.floor(_root.getBytesLoaded()*100/_root.getBytesTotal());
    trace("Percent loaded => "+percent);
    //Continue to load movie and move loader_mc frame according to percent loaded
    this.gotoAndStop(percent);
    //SWF has completed loading, fade preloader out and move playhead to "main"
    if(percent >= 100){
        gotoAndStop("transition");
        trace("Loading completed...");
        delete this.onEnterFrame;
    }
}


in my movie, i have a 100 frame preloader and the preloader instance(loader_mc) is supposed to play its corresponding frames while the main movie is loading. After loading has completed, the main timeline is supposed to go to the frame labeled "transition".

However, what's happening now is that the preloader "supposedly" plays through its 100 frame sequence and goes straight to the last frame where all the content are. The traces are also not showing up at all...

If the FLA is required to get a better understanding of the problem, i'll gladly provide it.

thanks

Embedded Swf Not Functioning Properly
why is this?

if i link directly to this swf it works:

http://www.kitemath.com/nepsi/dev/swf/nepsi-ticker.swf

when the same swf is embedded into a simple html page via Dreamweaver it doesn't work:

http://www.kitemath.com/nepsi/dev/home.htm

it's the same swf, in the same location.

Form Under Mask Not Functioning
Hi, I've created a flash presentation with a contact form. This contact form resides inside a movie that is cloaked by a mask. The funny thing is my input text fields are not functioning under this mask. However my combo boxes are active and respond to my mouse click. Is this a Flash limitation, that input fields don't function when masked?
Any clarification or feedback would be appreciated.

GetURL Not Functioning Correctly
I have used this a billion times in flash mx 2004, but with Flash 8 it seems to be broken. I have the following on some of my buttons:

on (release){
getURL("page.html", _self)
}

What happens, however, is that a new window opens for the first button you push. After the new window is open then the buttons behave as designed. If I close that window then it will reopen a new window (just one). Same for IE 7 and Firfox.

Any thoughts? To test this go to HERE.





























Edited: 01/07/2007 at 09:21:00 AM by harms239b

Global Score NOT FUNCTIONING
Hello:
My score does not appear at all in the score box (dynamic text field) referenced as insert_txt.text when I press the submit button, even if I give the correct or wrong answer.

"myScore" is referenced as the var



I performed a trace ("clik") and the button seems to be working properly.

Please help.







Attach Code

[AS]stop();
//set the inital score
_global.myScore = 0;
//
submit_btn.onRelease = function() {
if (_root.insert_txt.text == "lascaux" || _root.insert_txt.text == "Lascaux") {
myScore += 5;
trace("clik")
} else {
myScore += 0;
}
};[/AS]

Non-functioning External Swfs
Hello all,

This is a fair old bit to read, and for that I apologise but I feel the only way for anyone to understand all the elements that could be contributing to this problem is to explain (try) in detail.

I have a problem getting external .swf's to function properly in my "main.swf" file.

In "main.swf" I have a movieClip variable called: "loadPage" and I have 7 buttons which load transitions (in and out) externally from a folder: "bitmapPage" into the "loadPage" variable.

On the first frame of the "main.swf" the first transition is loaded:
Code:

_global.trans = "1";
trans = "1";
loadMovie("bitmapPage/bitmap"+_global.trans+".swf", _root.loadPage);
stop();

On the buttons: 'onRelease' the present .swf plays "out" and the required .swf plays "in"

Code:
on (release) {
if (_global.trans == "1") {
stop();
} else {
_global.trans = "1";
trans = "1";
_root.loadPage.gotoAndPlay("out");
}
}

This works fine and I have used it countless times with all sorts of content within the transition files.

Now, this time within the transitions I have an image slider which has 6 buttons. On release of each of these buttons the slider slides to the appropriate image. Simple enough...

These transitions ("bitmap1,2,3,4,etc.swf) work perfectly when published individually. Yet when called upon by the buttons in "main.swf" they can be seen but the slider does not work at all...

When viewing the problem from the "main.swf" the output error message I get is this:

Target not found: Target="_root.control2" Base="_level0.loadPage"

"Control2" refers to the image slider controller within the"bitmap.swfs"

After all that I have mad respect for you for even reading this far!
I just hope it all made sense...

Thank you!

Scale9 Not Functioning Properly
Hi everyone, issue:

I have 2 (vector roundtangle) movieclips on the stage both with scale9 enabled. When I tween them, scale9 only applies to one clip and not the other. I'm using mcTween but this shouldn't make a difference.

Any ideas as to why this is happening?

OnLoadProgress Not Functioning On Server
Greetings,

I have an onLoadProgress function (AS2) which is working locally but not when uploaded to the server.


Code:
listener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
var percentage:Number = Math.round( bytesLoaded/bytesTotal * 100);
container[this.ttt].p_text.text = String(percentage)+" %";
//trace(percentage);
}
the p_text.text is being updated(as expected) when tested locally in simulate download mode, but when I test the same swf from the server, I am getting a blank instead of the percentage updated number, then when the code gets to listener.onLoadComplete, everything is going back to normal.

Any suggestion?

Thank you

Submit Button Not Functioning
I have  a flash movie with a submit button which leads to another flash booking form book.swf .  I am working in asp environment. My actionscript for the submit button is as follows :

on (release){

    submitAttendees();

}


Somehow my scripts work fine on design machine , but the submit button goes dead on the live server. Anyone know what could be responsible ?




Gotoandlearn Mp3 Player Not Functioning
I successfully built the mp3 player from the Gotoandlearn.com tutorials. It works perfectly in a .swf player and when it's compiled in Flash, but the moment I try to play it in a browser... it doesn't connect. The textfield says undefined.
Being unknowledgeable of Flash, I have no idea why it can't connect to the files when it's being viewed from a browser.

Any ideas? Need to see the files? http://clay.bellmor.com/testsite/player

Also! Opening the player.swf file in Safari and FF doesn't work, but opening the player folder and then clicking on the .swf (so it loads the .swf by itself) works properly...

I'm 'guessing' there's something wrong with the class setting, maybe it doesn't know where to look...

Any help would be great!

-Clayton

Key Commands For Presentation Not Functioning
I have a swf loading external movies for a training presentation. Basically its a PowerPoint presentation but developed and animated in AfterEffects and Flash.

The main movie has been set up so that each scene is a slide. I have an MC on each slide calling:




ActionScript Code:
onClipEvent (enterFrame) {
    if (Key.isDown(32)) {
        gotoAndPlay("slide01");
    }
    if (Key.isDown(13)) {
        gotoAndPlay("slide01");
    }
    if (Key.isDown(39)) {
        gotoAndPlay("slide01");
    }
    if (Key.isDown(37)) {
        gotoAndPlay("main");
    }
}



My problem is that only the enter key works. The others don't want to respond at all and it only works when I preview the movie. If I open the SWF or EXE separately nothing responds. Is my code wrong? I got the keyboard codes out of Flash's own help library.

OnEnterFrame Is Not Functioning As Expected
I have been trying to figure out what is wrong with this code that's on frame 1 of the main timeline since yesterday =>


ActionScript Code:
loader_mc.onEnterFrame = function(){
    loaded = Math.round(getBytesLoaded() / 1024);
    total = Math.round(getBytesTotal() / 1024);
      percent = Math.round((loaded/total) * 100);
    //_global.loadedPercent += Math.floor(_root.getBytesLoaded()*100/_root.getBytesTotal());
    trace("Percent loaded => "+percent);
    //Continue to load movie and move loader_mc frame according to percent loaded
    this.gotoAndStop(percent);
    //SWF has completed loading, fade preloader out and move playhead to "main"
    if(percent >= 100){
        gotoAndStop("transition");
        trace("Loading completed...");
        delete this.onEnterFrame;
    }
}



in my movie, i have a 100 frame preloader and the preloader instance(loader_mc) is supposed to play its corresponding frames while the main movie is loading. After loading has completed, the main timeline is supposed to go to the frame labeled "transition".

However, what's happening now is that the preloader "supposedly" plays through its 100 frame sequence and goes straight to the last frame where all the content are. The traces are also not showing up at all...

If the FLA is required to get a better understanding of the problem, i'll gladly provide it.

thanks

Tween Not Functioning The Second Time Through
hi,
as3 is very cool, but event the most simple things can be bothersome. could anyone take a look at this code and tell me if they see any mistakes? it all works fine down to instructionsTween2. if i comment that line and the next line out, and uncomment //loadGame, everything is fine again, but as is this does nothing except tween out a piece of _instructions.playBtn_mc, which is pretty odd. ive looked through all tutorials and information that i can find on display objects, but couldnt find any methods that seem tailored to this problem (heck, lets be honest, i tried them all out anyway). and of course, you should comment on whatever else ive done that is just plain stupid.
Code:

package
{
   import flash.display.MovieClip;
   import fl.transitions.Tween;
   import fl.transitions.easing.*;
   import fl.transitions.TweenEvent;
   import flash.events.MouseEvent;
   import caurina.transitions.*;
   
   public class StartGame extends MovieClip
   {
      private var _instructions:mcInstructions;
      private var _memoryGame:MemoryGame;
      
      public function StartGame()
      {
         showInstructions();
      }
      
      private function showInstructions():void
      {
         _instructions = new mcInstructions();
         addChild(_instructions); //child of StartGame
         _instructions.x = 50;
         _instructions.y = 50;
         _instructions.alpha = 0;
         var instructionsTween:Tween = new Tween(_instructions, "alpha", Elastic.easeOut, _instructions.alpha, 100, 500, true);
         _instructions.playBtn_mc.addEventListener(MouseEvent.CLICK, fadeInstructions);
         _instructions.playBtn_mc.buttonMode = true;
      }
      
      private function fadeInstructions(event:MouseEvent):void
      {
         var instructionsTween2:Tween = new Tween(_instructions, "alpha", Elastic.easeOut, 100, 0, 1000, true);
         instructionsTween2.addEventListener(TweenEvent.MOTION_FINISH, loadGame);
         //loadGame();
      }
      
      private function loadGame():void
      {
         removeChild(_instructions);
         _memoryGame = new MemoryGame();
         addChild(_memoryGame);
         _memoryGame.alpha = 0;
         var gameTween:Tween = new Tween(_memoryGame, "alpha", Elastic.easeOut, _memoryGame.alpha, 100, 500, true);
      }
   }
}
thanks,
freddy

XML And Flash, Slideshow Not Functioning
I followed Lee's tutorial "Flash XML Basics" to construct a similar slideshow for a site I'm buiding. Basically, a dynamic driven series of photos with captions. I followed Lee's instructions and code to the letter, (triple checked code and syntax), and when testing the movie in Flash, get the following error messages:

Error opening URL "file:///Macintosh%20HD/Users/danielknol2/Documents/OMMVC%20PROJECTS/OMMVC%20WEB%20DEVELOPMENT/identity.xml"

Error opening URL "file:///Macintosh%20HD/Users/danielknol2/Documents/OMMVC%20PROJECTS/OMMVC%20WEB%20DEVELOPMENT/undefined"

The word "undefined" shows up in the caption block, and no photos.

I'm not a Flash guru yet, but it seems Flash cannot find the root URL folder? (my guess).

I'm on a Mac, OS 10.4.6 Tiger, using Flash 8.0 Pro, and Dreamweaver 6.0 to create the XML doc.

Any suggestions would be greatly appreciated.

Shared Object Not Functioning In IE 6 For PC
I'm using flash cookies to check if a movie been seen before, it all works perfectly in every browser across PC/mac, but simply won't work in IE 6. Any ideas? I searched and don't see any complaints on this I must be missing something here. Thanks.

Tell Targets And Functioning Between Diff Scenes
ok heres my problem


im working on this site

http://24.179.36.189/FLASH-site/

and i made the news section in a single movie clip(paltes) and i used tell targets for the menu button and the news button, and all this is in a scene called news now on the products button i have it set now to play the outro animation wich is inside the movie clip (plates) and then once it plays the outro i wanted it to progress onto frame one of the next scene "products" right now i have the following code on the products button

-----------------------------
on (release) {
gotoAndPlay ("outro");
}
________________________________

but thats inside the movie clip and once it finishes the last frame it just sits there, how can i make the button go to and play "outro" and tehn go to the scene "products" i need this to work so i can use the same code for all the buttons so it can play the outro then go to the "contacts" scene etc etc ya get it???

External Swf. Loaded Not Functioning Correct
Hi, I have a main movie loading an external swf.(djs.swf) that has a drag drop effect. It works perfectly...
BUT
When I embed It, the Drag DROP doesn't function, it can't find the trigger. If I play the djs swf. on it's own embedded it seems to be OK.

I assume it's a problem with the Hierarchy but I can't find the solution.

Any help would be GREAT!

djs-swf Drag script...............................

on (press) {
startDrag ("/one");
}
on (release) {
stopDrag ();
if (getProperty("/one", _droptarget) eq "/trigger") {
tellTarget ("/status") {
gotoAndPlay ("maya");
}
setProperty ("/one", _x, "38");
setProperty ("/one", _y, "162.8");
} else {
setProperty ("/one", _x, "38");
setProperty ("/one", _y, "162.8");
}
}

.........................

Main movies calling script:

on (release) {
loadMovie ("flash/djs.swf", "_level2");
gotoAndStop ("clicked");
}

Slide Menu Script Not Functioning
I've got a basic sliding menu set up in which I have another version that works, but after I lengthened the size of my panel and made the proper changes to the x coordinates, it does not work.

Maybe I miscalculated the x but I don't think so.

The .fla is on my website at a link at http://www.timothydahl.com

If anyone has any ideas I'd appreciate the assistance.

ww

Multiple Drag/drop Not Functioning Together
why is it that when I use:

onClipEvent (mouseDown) {
startDrag (w_rook_1, true);
}
onClipEvent (mouseUp) {
stopDrag ();
}


on multiple MC's (inside another aMC), I can't drag more than one piece? and it is not smooth?

Is there a better way to do this

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