Cant Execute Function With SetInterval
ActionScript Code: _root.logo._alpha = 0; //Sätt alpha på logon till 0_root.meny._alpha = 0; //Sätt alpha på menyn till 0var donealpha:Boolean = false; //skapa en Booleanvar doneshrink:Boolean = false; //skapa en Booleanvar donemove:Boolean = false; //skapa en Booleanvar doneenlarge:Boolean = false; //skapa en Booleanvar logorutashrink:Boolean = false; //skapa en Booleanvar menyalpha:Boolean = false; //skapa en Booleanvar logofadeID;var logoshrinkID;var menyalphaID;var doneenlargeID;var logorutashringID;var logomoveID;function logorutashrink(){ //Funktion för att förminska logorutanif(donealpha == true && doneshrink == true && donemove == true && doneenlarge == true){ //Om allt annat är klart if(_root.logoruta._yscale > 28){ //kolla så att logoruta är störra än 28 _root.logoruta._yscale -= 1; //minska med 1 }else{ //annars logorutashrink = true; //sätt logorutashrink till true clearInterval(logorutashringID); } }}function menyalpha(){ //Funktion för att fada fram menyn if(donealpha == true && doneshrink == true && donemove == true && doneenlarge == true && logorutashrink == true){ //om allt annat är klart if(_root.meny._alpha != 100){ //kolla så att alpha inte är 100 _root.meny._alpha += 1; //öka med 1 }else{ //annars menyalpha = true; //sätt menyalpha till true clearInterval(menyalphaID); } }}function logofade(){ //Funktion för att fada fram loggan if(_root.logo._alpha != 100){ //Kolla så att alpha in redan är 100 _root.logo._alpha += 1; //Om in så öka med 1 }else{ // om den är 100 donealpha = true; //Sätt donealpha booleanen till true clearInterval(logofadeID); }}function logoshrink(){ //Funktion för att minska loggan if(donealpha == true){ //Om logofade är klar så fortsätt if(_root.logo._xscale != 0 && doneshrink == false){ //kolla så att doneshrink är false och att xscale inte är 0 _root.logo._xscale -= 1; //Minska xscale med 1 _root.logo._yscale -= 1; //Minska yscale med 1 }else{ //om xscale är 0 eller doneshrink är true doneshrink = true; //sätt doneshrink till true clearInterval(logoshrinkID); } }}function logomove(){ //Funktion för att flytta loggan till vänstra hörnet if(donealpha == true && doneshrink == true){ //kolla så shrink och alpha på loggan är klara _root.logo._x = 30; //Flytta loggan till X 30 _root.logo._y = 30; //Flytta loggan till Y 30 donemove = true; //Sätt donemove till true clearInterval(logomoveID); }}function logoenlarge(){ //Funktion för att förstora loggan igen //trace(_root.logoruta._yscale); //trace("Alpha: " + donealpha + " Shrink: " + doneshrink + " Move: " + donemove + " Enlarge: " + doneenlarge + " Shrink: " + logorutashrink) if(donealpha == true && doneshrink == true && donemove == true){ //kolla så att dom 3 andra funktionerna är klara if(_root.logo._xscale == 40){ //kolla om xscale är 40 doneenlarge = true; //sätt doneenlarge till true clearInterval(doneenlargeID); }else{ //annars... _root.logo._xscale += 1; //öka xscale med 1 _root.logo._yscale += 1; //öka yscale med 1 } }}logofadeID = setInterval( logofade, 5); //kör logofade var 5:e mslogoshrinkID = setInterval( logoshrink, 8); //kör logoshrink var 8:e msmenyalphaID = setInterval( menyalpha, 5); //kör menyalpha var 5:e msdoneenlargeID = setInterval( logoenlarge, 8); //kör logoenlarge var 8:de mslogorutashringID = setInterval( logorutashrink, 5); //kör logorutashrink var 5:e mslogomoveID = setInterval( logomove, 1000); //kör logomove varje sekund
The first two functions wont get executed.. I have tried to put trace("test") strait under the function ...(){ but it wont execute it.. Any1 who can see the problem?
Best Regards Latis
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 03-19-2004, 02:52 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Cant Execute Function With SetInterval
ActionScript Code:
_root.logo._alpha = 0; //Sätt alpha på logon till 0_root.meny._alpha = 0; //Sätt alpha på menyn till 0var donealpha:Boolean = false; //skapa en Booleanvar doneshrink:Boolean = false; //skapa en Booleanvar donemove:Boolean = false; //skapa en Booleanvar doneenlarge:Boolean = false; //skapa en Booleanvar logorutashrink:Boolean = false; //skapa en Booleanvar menyalpha:Boolean = false; //skapa en Booleanvar logofadeID;var logoshrinkID;var menyalphaID;var doneenlargeID;var logorutashringID;var logomoveID;function logorutashrink(){ //Funktion för att förminska logorutanif(donealpha == true && doneshrink == true && donemove == true && doneenlarge == true){ //Om allt annat är klart if(_root.logoruta._yscale > 28){ //kolla så att logoruta är störra än 28 _root.logoruta._yscale -= 1; //minska med 1 }else{ //annars logorutashrink = true; //sätt logorutashrink till true clearInterval(logorutashringID); } }}function menyalpha(){ //Funktion för att fada fram menyn if(donealpha == true && doneshrink == true && donemove == true && doneenlarge == true && logorutashrink == true){ //om allt annat är klart if(_root.meny._alpha != 100){ //kolla så att alpha inte är 100 _root.meny._alpha += 1; //öka med 1 }else{ //annars menyalpha = true; //sätt menyalpha till true clearInterval(menyalphaID); } }}function logofade(){ //Funktion för att fada fram loggan if(_root.logo._alpha != 100){ //Kolla så att alpha in redan är 100 _root.logo._alpha += 1; //Om in så öka med 1 }else{ // om den är 100 donealpha = true; //Sätt donealpha booleanen till true clearInterval(logofadeID); }}function logoshrink(){ //Funktion för att minska loggan if(donealpha == true){ //Om logofade är klar så fortsätt if(_root.logo._xscale != 0 && doneshrink == false){ //kolla så att doneshrink är false och att xscale inte är 0 _root.logo._xscale -= 1; //Minska xscale med 1 _root.logo._yscale -= 1; //Minska yscale med 1 }else{ //om xscale är 0 eller doneshrink är true doneshrink = true; //sätt doneshrink till true clearInterval(logoshrinkID); } }}function logomove(){ //Funktion för att flytta loggan till vänstra hörnet if(donealpha == true && doneshrink == true){ //kolla så shrink och alpha på loggan är klara _root.logo._x = 30; //Flytta loggan till X 30 _root.logo._y = 30; //Flytta loggan till Y 30 donemove = true; //Sätt donemove till true clearInterval(logomoveID); }}function logoenlarge(){ //Funktion för att förstora loggan igen //trace(_root.logoruta._yscale); //trace("Alpha: " + donealpha + " Shrink: " + doneshrink + " Move: " + donemove + " Enlarge: " + doneenlarge + " Shrink: " + logorutashrink) if(donealpha == true && doneshrink == true && donemove == true){ //kolla så att dom 3 andra funktionerna är klara if(_root.logo._xscale == 40){ //kolla om xscale är 40 doneenlarge = true; //sätt doneenlarge till true clearInterval(doneenlargeID); }else{ //annars... _root.logo._xscale += 1; //öka xscale med 1 _root.logo._yscale += 1; //öka yscale med 1 } }}logofadeID = setInterval( logofade, 5); //kör logofade var 5:e mslogoshrinkID = setInterval( logoshrink, 8); //kör logoshrink var 8:e msmenyalphaID = setInterval( menyalpha, 5); //kör menyalpha var 5:e msdoneenlargeID = setInterval( logoenlarge, 8); //kör logoenlarge var 8:de mslogorutashringID = setInterval( logorutashrink, 5); //kör logorutashrink var 5:e mslogomoveID = setInterval( logomove, 1000); //kör logomove varje sekund
The first two functions wont get executed.. I have tried to put trace("test") strait under the function ...(){ but it wont execute it..
Any1 who can see the problem?
Best Regards
Latis
Using SetInterval() To Execute Animation Faster Than Framerate
Earlier we discussed making an animation movie clip independent of frame
rate and used the following code in the first frame of a movie clip (call it
"mc"):
var interval_between_frames=100;
var interval_between_frames_reference;
if (interval_between_frames_reference)
{
clearInterval(interval_between_frames);
}
interval_between_frames_reference = setInterval(this, "nextFrame",
interval_between_frames);
stop();
and put stop(); into the rest of the frames of mc.
However this work one direction only - it can slow down the speed of the
animation below the framerate, but it cannot increase it above the frame
rate.
I.e. if in my FLA file I have an mc with the above code and in the main time
line I place
attachMovie("mc","mc",depth)
and set the framerate of my FLA to 1, the mc executes at 1 fps
irrespective of value of interval_between_frames.
Why is that and how can I use setInterval() to execute faster than
framerate?
Execute A Function Each 2 Sec
Hi. Im writting a function to display a graphic, but I want it to draw the graphic slowly. So, I wrotte a function, whose argument is y, and tried to do this, on my scene's 1st keyframe:
controlY = 0;
tempo = 500;
function moveOn() {
gotoAndPlay(2);
}
timer = setInterval(moveOn(), tempo);
y = 1; // I would give the arg somewhere else, but this is a trial
function pos(y) {
trace("foi"+controlY); // if i would see this, then the function works
// y=ax2+bx+c to remember the equation
x = 2;
attachMovie("dot", "dot"+y, 1);
setProperty("dot"+y, _x, x);
setProperty("dot"+y, _y, controlY);
controlY++;
}
and on my 2nd keyframe:
gotoAndPlay(1);
clearInterval(timer);
Function Does Not Execute At First
Right. I'm having a lot of strange bugs in this project I'm doing. Actual bugs in Flash that get saved into my fla but I managed to get it to work at the end.
Just 1 strange behaviour left.. Please, please advise if you recognise this;
- Timeline enters movieclip frame for the first time.
- I call a function to execute, it does not.
- Normal commands do execute on that frame.
- After this first denial my functions execute when I enter the same frame.
This happens everywhere in my .fla ...
Does anybody know what the H is going on?
How To Execute A Function Inside A MC ...
Hello, here me problem:
I have a function init() inside of my mc.
This function set the colour of the object.
But, i dont know hy, i can't execute it!
Strange things happen.
What i want is called the function, set the color and
play the movie. The movie must not run 'till it's initialised because the value set is used in the next frames.
The mc is in the libtairy, and I use attachMovie()
to attach it to root ..
Tnx!
Execute A Dynamic Function
I am trying to build a component which executes a function that is identified in one of the many variables passed to it.
Lets say that i pass the string: "saveas", i want it to execute an either relative or global function "saveas" upton click.
Execute Function In Frame
I have a working function:
btn1.onPress = function(){
window_mc.resizeTo(500, 500, 1, "easeoutelastic")
}
this works fine. But how can I execute that function without an onPress action, just when the movie enters a certain frame?
I tried :
onClipEvent (enterFrame) {
function(){
window_mc.resizeTo(500, 500, 1, "easeoutelastic")
}
}
this won't work...
just window_mc.resizeTo(500, 500, 1, "easeoutelastic") won't work...
Please help.
Wait, Then Execute A Function
What I want to happen is to make a function the waits x milliseconds, then runs another function.
Like this:
Code:
function1 = function(x){
//wait x
function2()
}
Intervals ran the function ran the first time without wait the x milliseconds, so that didn't work. Any ideas?
Method Won't Execute From Within Function
Can anyone take a look at this class file and tell me why the setSongListProp() method is not being executed when called within the XML instance's onLoad event? If i bring the method call outside of the onLoad function it then executes properly, so seems like maybe I'm not calling it correctly from within the onLoad function, but I don't know why.
Thanks.
Code:
class mp3Player
{
//properties
public var titlePlaying:String;
public var artistPlaying:String;
public var albumPlaying:String;
public var pathToPlaying:String;
public var songList:Array;
public var progressFraction:Number;
private var listXML_xml:XML;
//constructor
public function mp3Player(path:String)
{
listXML_xml = new XML();
listXML_xml.ignoreWhite = true;
listXML_xml.load(path);
listXML_xml.onLoad = function(success:Boolean)
{
if(success == true)
{
trace("about to fire setSongListProp()");
setSongListProp();
}
else
{
trace("no success on XML load");
}
}
}
//methods
private function setSongListProp():Void
{
trace("setSongListProp() triggered");
var i:Number;
var songList:Array;
for (i=0; i<listXML_xml.firstChild.childNodes.length; i++)
{
var songTitle:String = listXML_xml.firstChild.childNodes[i].firstChild.firstChild.nodeValue;
var songArtist:String = listXML_xml.firstChild.childNodes[i].childNodes[1].firstChild.nodeValue;
var songAlbum:String = listXML_xml.firstChild.childNodes[i].childNodes[2].firstChild.nodeValue;
var songPath:String = listXML_xml.firstChild.childNodes[i].childNodes[3].firstChild.nodeValue;
var songArray:Array = new Array(songTitle, songArtist, songAlbum, songPath);
trace("songArray for "+i+" is "+songArray[0]+", "+songArray[1]+", "+songArray[2]+", "+songArray[3]);
songList.push(songArray);
}
trace("second title and artist is "+songList[1][0]+" "+songList[1][1]);
this.songList = songList;
}
}
Execute A Function And Wait 1 Second
I have an event that i want to be dispached, run some code and then wait 1 second to get out of the event function.Is it possible to do it with timer and how?The reason i want to do this is because the event runs alot of times and the programs stuck during the execution proccess (a directory file listing is loaded and then for each mp3 in the directory an ID3 event is executed to load the id3 to xml)
Wait, Then Execute A Function
Basically what I am trying to do is to make a function, wait x milliseconds, then execute another function.
Example:
ActionScript Code:
function1 = function(x){
//wait x
function2()
}
I tried using intervals, but they executed the function right as I set it. Can anyone help?
Execute String As A Function
Hello Friends,
Can anyone guide me through this...
I want to execute a string as as a normal statement line...
for example...
var str:String = "trace('done')";
function abc() {
str;
}
I want this code to work as:
function abc() {
trace('done');
}
Please help me guys, I am in trouble...
Your help will be highly appreciated...
Thanks in anticipation...
Looking for your reply...
How To Execute A String As A Function
Hi, I'm trying to make a function that can take a string formatted as a function command and execute it.
For example I want to take
Code:
var myString:String = "runFunction(var1, var2, var3);"
and then execute that string as a function. I've tried
Code:
eval(myString);
and didnt seem to work. Anyone have ideas on how I can accomplish this? Thanks-
Unable To Execute An If Function
Hi, I'm trying to call this function from another one but for some reason it on executes the first trace but does not go into the if statement. Can some one please give me a hand on this, I greatly appreciate it, Thank you.
function goAndFade(target_mc) {
trace("im new function");
this.onEnterFrame = function() {
if(target_mc._alpha < 100) {
trace("I'm in loop");
target_mc._alpha = target_mc._alpha + 20;
trace("alphe @ : " + target_mc._alpha);
}else delete this.onEnterFrame;
}
}
[Flash8] Execute Function Only Once Per Second?
Hi Kirupa!
Can someone pls help me to make function execute only once per second in ActionScript 2.0? As always I'll start from example to explain my problem...
I have aprox. 15 buttons on my stageand all of them are calling the same function, but with different arguments. This function executes some effects, that lasts for 1 second. If someone will click on that buttons more often, than once per second, that will look horrible
I can disable that button, what was pressed, but this will not solve the problem, be cause someone in a hurry can click another button.
So how to make so, that the function will not execute more often, than once per second?
P.S.
It has to execute first, than wait, not wait, than execute...
Thanks in advance and sorry for my english.
Elegant Way To Execute A Function Once?
Last edited by M40 : 2006-01-01 at 10:30.
Hello! Here is a piece of code. The idea is "exampleFunction()" to be executed only once. I do it using the code below the comment, but I wonder if tere is some more elegant way.
ActionScript Code:
example_mc._alpha = 0;
example_mc.onEnterFrame = function(){
this._alpha++;
if(this._alpha>20){
//Here comes the question code
if(!executed){
exampleFunction();
executed = true;
}
}
}
Thank you!
Execute Function After Time Period
I would like to know what actionscript I need to add to the following code in order for the second function (gotoAndStop) to occur after a three second pause. Thanks.
on (release) {
getURL("http://www.chasingerections.com/ChasingErectionsSmall.mov",_blank);
gotoAndStop(order);
}
Execute Function In External Loaded Swf
Peepz,
I have a loader class which loads an external movieclip, in my complete handler i want to execute a function (functionname = loadLessons) on keyframe 1 in de external loaded swf:
PHP Code:
//Loader Class
function loadPage(url, holder):void
{
var assetsUrl:String = url
var loader:Loader = new Loader();
configureListeners(loader.contentLoaderInfo);
var assestsRequest:URLRequest = new URLRequest(assetsUrl);
loader.load(assestsRequest);
loader.addEventListener(Event.COMPLETE, completeHandler);
holder.addChild(loader);
}
function completeHandler(event:Event):void
{
trace("completeHandler: " + event);
//event.target.loadLessons()
var init:Function = event.target.loader.parent.loadLessons
init()
}
But i get this error:
TypeError: Error #1006: value is not a function.
at index2_fla::MainTimeline/completeHandler()
Con somebody let me execute the function?
Thnx!
OnRollOver For 2 Sec Then Execute A Function Or Tweening
Hi,
I made a menu with buttons.
When i go over a menu a submenu will appear. I just play a tweening.
The submenu slides from left to right.
Code:
menu_mc.m_info_btn.onRollOver = function(){
_root.menu_mc.gotoAndPlay("over_info");
}
Then i created a button with only hotspot in HIT.
So when someone goes over the invisble button the submenu will dissapear.
But i'd like a delay.
So when the person hits the invisible buttons during 2 seconds then the submenu should dissapear.
Cause right now I have the menu on top left.
And you go over it. The submenu appears under the menu. But when you want to quickly go the right side of the submenu you might touch the invisble hotspot and then the submenu dissapears.
Thats why im looking for a way that you have to be atleast 2 sec on the invisble button before it should starting dissapearing(tweening)
Hope you guys can help me out.
Gosa
Use Variable As Part Of Function Name To Execute?
if I have an if/else tree that changes a _root variable, can I run a function using that variable as part of the name of the function to be run?
I have a card game with three automated computer players, and rather than have their actions be determined by the same exact same code duplicated for all three of them, with the only difference being 'P2' or 'P3' or 'P4' as the names of the variables in my if/else trees, I'd rather condense the code to one function and have the outcome be for whichever player it was that was checking his hand before 'deciding' what to do. So I'm trying to condense code.
Anyway, I have a function called P2checks(), but to determine if flash should run that program I have a function called P2holeRANK, with if/else tree that makes sure certain parameters are met before running P2checks(). So, the problem here is that I also have P3holeRANK, and P4holeRANK, as well as P3checks() and P4checks() - all with the same if/else tree and variables as P2checks(), but with the corresponding 'P' being different...
So, to bottle the ends, I'm making a function called analyzeHoleCards, that runs through all the same if/else trees. At the beginning of the function I say:
ActionScript Code:
function analyzeHoleCards(){
if (playerToAnalyze == 2) {
//use these cards in the following analysis
}else if (playerToAnalyze == 3){
//use THESE cards in the following analysis
}else if (playerToAnalyze ==4 ){
//use these cards in the following analysis
}
////then the analysis runs, checking the players hand, the size of any raises, the size of the pot, et cetera
////then the analysis comes up with a final recommendation
//ie, PXraises, or PXchecks, or PXcalls, or PX folds
///these correspond to P2raises, or P3calls
////and here's what I'm really asking (finally)...
////I want to go:
if (playerToAnalyze == 2){
P2FINALRECOMMENDATION;
}else if (playerToAnalyze == 3){
P3FINALRECOMMENDATION;
}else if (playerToAnalyze == 4){
P4FINALRECOMMENDATION;
}
}
//where 'FINALRECOMMENDATION' is a text string of either: 'checks', 'calls', 'raises', 'folds'
so basically, if playerToAnalyze was 2, I want to run 'analyzeHoleCards', which will then see that P2 is being analyzed and run the analysis, and then when it's made it's recommendation, I want that to be a text string that gets added to 'P2' so that it becomes 'P2checks' or 'P2raises' - and then RUN that function (functions I've already created...)
is that possible, or when you run a function does it have to be run using ironclad text/name to fire it?
very sorry for the long-winded explanation, but I want to make sure you have all the info. Thanks in advance for any help!
How To Execute A Function In Parent Instance?
Thanks for the very good help on my last question, cant really help with the other questions on the board, but I got stuck again my own self :.
So I make a document class, in which I create a instance of another class. Now I want to call to a function in the parent class. Is that possible?
ActionScript Code:
package
{
public class Main extends MovieClip
{
public var Instance001:CustomClass1 = new CustomClass1;
public var Instance002:CustomClass2 = new CustomClass2;
public var ArrayVar:Array = new Array();
public function Main()
{
addChild(Instance001);
addChild(Instance002);
ArrayVar = Instance001.function();
//the function gives this array its value.
}
public function GetValue(casenumber:int):Array
{
switch(casenumber)
{
case 1: return ArrayVar;
}
}
}
}
package classes
{
public class CustomClass2
{
private var ArrayVar:Array = new Array();
public function CustomClass2()
{
ArrayVar = this.parent.GetValue(1);
}
}
}
For the next step I need to be able to get variables inbetween instances, so this help would be appreciated.
Im doing this in a OOP approach to have different functions spread over different classes (in this case, a background is in a different instance from the main class from the player). So it could be im doing it in the wrong OOP way, so any suggestions are welcome.
Using Button To Execute Function Then Go To The Next Frame
Hi all,
I have MC1 on the main timeline. MC1 contains another mc and a button. What I'm trying to do is when click the button, it executes a function and when it's done executing, it goes to the next keyframe on the maintimeline. On the first keyframe of MC1, I have this:
PHP Code:
stop();
function funName(mc) {
statement;
}
and then on the button, i have this:
PHP Code:
on(release) {
_root.MC1.funName(_root.MC1.MC2);
_root.gotoAndPlay("nextFrame")
}
But it's not working right now...it overwrites the function and goes to the next frame on the main timeline right away. Can anyone please tell me what I'm suppose to do? Thanks..
Can Dynamic Text Execute An AS Function?
I've always wanted to figure this one out. If I have a dynamic text field with HTML text or even without, can I create a link that executes a function within Flash?
I know I can create a link to itself with a variable and pass that variable through javascript and have it run, but that requires refreshing the browser. Is there a more seamless way to do it?
Thanks!
Execute Function In External Loaded Swf
Peepz,
I have a loader class which loads an external movieclip, in my complete handler i want to execute a function (functionname = loadLessons) on keyframe 1 in de external loaded swf:
ActionScript Code:
//Loader Classfunction loadPage(url, holder):void{ var assetsUrl:String = url var loader:Loader = new Loader(); configureListeners(loader.contentLoaderInfo); var assestsRequest:URLRequest = new URLRequest(assetsUrl); loader.load(assestsRequest); loader.addEventListener(Event.COMPLETE, completeHandler); holder.addChild(loader); } function completeHandler(event:Event):void { trace("completeHandler: " + event); //event.target.loadLessons() var init:Function = event.target.loader.parent.loadLessons init()}
But i get this error:
TypeError: Error #1006: value is not a function.
at index2_fla::MainTimeline/completeHandler()
Con somebody let me execute the function?
Thnx!
5 Minute Countdown, Execute Function?
Hey all,
Real quick question... is there an easy way to begin a timer onRelease that counts 5 minutes, when it is done, executes another function in the movie?
I have found a lot of larger countdown timers for days and years, but I am having trouble simplifying to a matter of minutes and then executing a function. thanks in advance for any help
How To Execute A Function In An Externally Loaded Swf?
I've loaded an external swf using the following code....
Code:
this.myRequest = new URLRequest("test.swf");
this.myLoader = new Loader();
this.myLoader.load(this.myRequest);
this.oRender.addChildAt(this.myLoader, 4);
I want to execute a function in test.swf from the parent swf....
How can I do this?
Execute Function In Embedded Flex App From Swf
Hi,
I have a flex flv player application that I'm loading into a wrapper flash movie. The flv player works great with the exception of one thing... when you go to a different area, any playing movies are not unloaded properly.
The flex application contains a "clearMovies()" function that I need to fire from the parent swf movie.
The main timeline loads a MovieClip with instance name "moviePlayer" on the main timeline... this "moviePlayer" contains the AS3 code to load flvPlayer.swf via loader... (The progress handler is handling a preloader, but I removed that code here)
Code:
var myLoader:Loader = new Loader();
var fileURL:URLRequest = new URLRequest("flvplayer.swf");
var importedPlayer:Object;
myLoader.load(fileURL);
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,fileLoaded);
myLoader.contentLoaderInfo.addEventListener(Event.INIT, initHandler);
function initHandler(e:Event):void {
importedPlayer = myLoader.content;
}
function fileLoaded(event:ProgressEvent):void {
if (event.bytesLoaded == event.bytesTotal) {
addChild(myLoader);
}
}
ok... On the same root timeline is a MovieClip "Navigation" that contains the following function that is executed when any navigation button is clicked...
Code:
function clearmovie():void {
if(MovieClip(this.root).moviePlayer) {
MovieClip(this.root).moviePlayer.importedPlayer.unloadMovies();
MovieClip(this.root).moviePlayer.removeChild(MovieClip(MovieClip(this.root).moviePlayer).myLoader);
}
}
I get "Error #1069: Property unloadMovies not found on _flvplayer_mx_managers_SystemManager and there is no default value." whenever the clearmovie() function is fired.
Can someone offer any help? I'm at a loss.
Thank you!
Kevin
Can Dynamic Text Execute An AS Function?
I've always wanted to figure this one out. If I have a dynamic text field with HTML text or even without, can I create a link that executes a function within Flash?
I know I can create a link to itself with a variable and pass that variable through javascript and have it run, but that requires refreshing the browser. Is there a more seamless way to do it?
Thanks!
SWF To Execute Javacript Function In Html
i've been doing some reading about the new feature in flash 8, ExternalInterface.call() where flash can execute js commands located in the html and return results.
I need flash to execute a simple js function i have made, but i don't need it to return anything back into the swf. i have googled how to use this feature but i can't seem to make it do what i need it to. this is the link i have been looking at:
http://www.adobe.com/devnet/flash/ar...erface_05.html
the function name i would want the swf to call is cEvent (nme) which would trigger other things to be executed in the html....hence not needing it to return anything to flash.
any help would be awesome.
Can FsCommand Execute A Flash Defined Function?
I Know FsCommand can set Variables and Control a Flash movie, but say for example that I have a defined Flash function:
function(name){
mytxt.text = name
}
How would I run this function using javascript or FSCommand in the browser window?
Any Help would be appreciated.
Execute A Flash Function When User Closes IE/Swf
Hello Guys, I am builing a chat application (not with Comm server)that sends a history of the current session to the database. Now If the User closes down his/her browser, how might I send the sharedObject.data.sessionHistory to the database?
I tried..
_root.onUnload=function(){
//code
}
but it didn't work.
Any suggestions?
OnLoad Function Does Not Want To Execute 3 Lines Of Code
Hi, quick actionscript question: WHAT IS WRONG? Trying to get data from database. The "http://www.laurierSOS.com/getsessiondata.php?course=1" works when you put it into the url of a browser. The info is 'echo'ed to the screen, but in my flash test, the onLoad function does not execute! I need it to execute - thoughts are MUCH appreciated!!
var receiver:LoadVars = new LoadVars();
receiver.onLoad = function()
{
DOES NOT GET INTO HERE!
}
receiver.sendAndLoad("http://www.laurierSOS.com/getsessiondata.php?course=1",this,GET);
stop();
Child Makes Parent Execute A Function?
Hello.
I have a movieclip (calendar) with a sub movie (create custom event). After I put all the information in the event screen such as date, description etc. I have a "save" button. When I click save I want the parent (calendar) to run a function called "populateEvents". Which basically looks through every day of the month to find any events. Since I just added one, it should run the function, see the new event then highlight the date.
Naturally I am having trouble with this. The child tells the parent to run the function but it ain't working.
Code:
MovieClip(this.parent).populateEvents();
That's the code I'm using and I can see in the trace window it is actually running the functions but it looks like it's trying to execute the functions from within itself, not from the parent movie so it of course will not work.
How To Execute A Function On The Root From A Movie Clip
Hello,
I am fairly new to AS3.0, so this is kind of a newbie question.
I have a function on the root timeline called addWave()
I would like to call that function from within a movie clip, but when I use
root.addWave(); or parent.addWave();
Flash acts like I am crazy
1061: Call to a possibly undefined method addWave through a reference with static type flash.displayisplayObject.
I would like to know how to run a function from another timeline in AS3.0.
PS: I am not using packages, so please give me a packageless solution
Thanks.
Flash Doesn't Execute The Stop() Function
Hi i have a question:
I have made a flash file with several movieclips that all have a stop() function at the end.
When i look at the .swf file it is working perfectly.
Only when i upload it to a site then it doesn't execute the stop() function.
When the flash file has stopped playing it should upload another flash file so the stop() function must be used.
I am using AS 2.0 , only that shouldn't matter because i am only using stop() functions.
Thanks
[F8] Need A Textbox To Execute Function When User Presses Enter
Hey guys,
I know this is probably quite a basic problem, but im fairly new at this and haven't really done anything with key presses (just mouse events). So im working on a mailing list where the user enters their email and when they press 'enter' i want it to execute the same function as if they clicked the 'submit' button (add email to the mailing list). It seems people are used to typing something in a textbox and pressing enter to continue, so i figure i have to implement this. I only want this to happen when the textbox is in focus.
How would i go about implementing this?
Thx
Text Area CSS: Execute Function On A:hover Or A:active?
I have a Text Area (scrolling) with links. I'm using CSS to format the text and links.
Does anybody know how to get an actionscript function to execute when the mouse is over one of these links? I'd prefer tying functionality to the a:hover and a:active CSS events, but I'm open to other suggestions.
Specifically, I'm trying to make a mouse-down-drag function that's tied to the CSS, as opposed to embedding a movieclip at each and every place a link appears.
Thanks in advance.
Execute A Function When Custom Class Has Finished With XML File...
I'm a bit new to using external custom classes so I'm having problems with it. I'm unable to find a good example of how to do this, or if it's best coding practice. Any help would be appreciated.
I've written an XMLLoader class and I'm instantiating it from the timeline of an FLA:
ActionScript Code:
var xmlLoader:XMLLoader = new XMLLoader("myXMLFileURL.xml");
Here's the code that handles the XML loading in the XMLLoader class:
ActionScript Code:
private function loadXML():void {
_xmlLoader = new URLLoader(new URLRequest(_xmlURL));
_xmlLoader.addEventListener(Event.COMPLETE, onXMLLoaded);
}
private function onXMLLoaded(event:Event):void {
//parse and process the XML nodes data into 3 arrays
// Can I send the FLA a message from here to tell it to execute a function?
}
I'd like the FLA to execute a function when it's finished it's business with the XML. I've tried this on the FLA timeline:
ActionScript Code:
xmlLoader.addEventListener(Event.COMPLETE, xmlCompleteHandler);
function xmlCompleteHandler(event:Event):void {
trace("xmlCompleteHandler: " + event.target);
}
...but obviously this doesn't work. What's the best way to go about this?
MovieClip.onRelease = MovieCLip.Protoype Function Fails To Execute Properly
Dear all,
I created a simpe function:
MovieClip.prototype.hiMe = function(me, theRest)
{
//declare the format colors white and grey
formatMe = new TextFormat();
formatMe.color = Colors[0];
formatMe.font = "Adventure Subtitles";
formatTheRest = new TextFormat();
formatTheRest.color = Colors[1];
formatTheRest.font = "Adventure Subtitles";
// assign grey to theRest
for (i =0 ; i < theRest.length; i++)
{
theRest[i].tfield.setTextFormat(formatTheRest);
}
// make the me white
me.tfield.setTextFormat(formatMe);
}
when I call it (bar[0] is an array of objects)
bar[0].invar.onRelease = hiMe(bar[0],bar);
it executes on load regardless of the onRelease eventHandler and the ownards it does not execute when exciting the event.
does somebody know why this may be?
Cheers
DDT
MovieClip.onRelease = MovieCLip.Protoype Function Fails To Execute Properly
Dear all,
I created a simpe function:
MovieClip.prototype.hiMe = function(me, theRest)
{
//declare the format colors white and grey
formatMe = new TextFormat();
formatMe.color = Colors[0];
formatMe.font = "Adventure Subtitles";
formatTheRest = new TextFormat();
formatTheRest.color = Colors[1];
formatTheRest.font = "Adventure Subtitles";
// assign grey to theRest
for (i =0 ; i < theRest.length; i++)
{
theRest[i].tfield.setTextFormat(formatTheRest);
}
// make the me white
me.tfield.setTextFormat(formatMe);
}
when I call it (bar[0] is an array of objects)
bar[0].invar.onRelease = hiMe(bar[0],bar);
it executes on load regardless of the onRelease eventHandler and the ownards it does not execute when exciting the event.
does somebody know why this may be?
Cheers
DDT
SetInterval Function Please Help
This function outputs 1 letter at a time. But continues run this same function over and over again. Anyone know how to stop this function after it finishes outputting the last character in the x value, and move onto the next frame.
y=0;
function printer()
{
x = "David";
output.text = x.charAt(y);
y++;
}
setInterval(printer, 1500);
Setinterval On Function
peepz,
i tried something with setInterval to disable a function for a few seconds, but is doesn't working:
Code:
onClipEvent(load){
//set some vars in the this.
this.speedY = 0;
this.speedX = 0;
this.damping = .7;
this.easing = .2;
this.homeX = this._x;
this.homeY = this._y;
//higher is more sticky
this.stickiness=4;
//bounce prototype
this.blaat = function(){
this.onEnterFrame = function(){
//if the mouse is not over the box
if (!this.hitTest(_root._xmouse, _root._ymouse) or this.pressed == true) {
//then bounce me home
this.bounceMe(this.homeX, this.homeY);
this.pressed = false;
} else {
//otherwise, drag me with some friction
difX = this._parent._xmouse-this.homeX;
difY = this._parent._ymouse-this.homeY;
this._x = this._parent._xmouse-(difX/this.stickiness);
this._y = this._parent._ymouse-(difY/this.stickiness);
}
}
}
this.blaat2 = function(){
this.onEnterFrame = function(){
//then bounce me home
this.bounceMe(this.homeX, this.homeY);
this.pressed = false;
}
}
}
on(rollOver){
this.blaat();
}
on(release){
setInterval(this.blaat(), 1000);
this.blaat2();
this.pressed = true;
}
its a sticky button and onrelease it has to bounce back!
maybe somebody can give me some advise?
thnx,
robert
SetInterval Function. . .
I need a little assistance in creating a setInterval function based on my xml file. If anyone could help, I would really appreciate it!
Here's a sample of xml file:
<count id="1">
<mediatype>1</mediatype>
<information>Introduction</information>
<endtime>12</endtime>
</count>
<count id="2">
<mediatype>2</mediatype>
<information>Clip 2</information>
<endtime>50</endtime>
</count>
<count id="3">
<mediatype>3</mediatype>
<information>Clip 3</information>
<endtime>150</endtime>
</count>
This is a sample of my actionscript:
Code:
myInterval = setInterval(beginFadeOut, time());
function beginFadeOut() {
clearInterval(myInterval);
mc.fadeIn(100, 7);
}
function time() {
sec = ((10/5)*1000);
trace("seconds called");
return sec;
}
eg.
sec = parent.childNodes[i].firstChild;
So, the value would be put in an array. I have tried several things, and have tried to ask the form, but no response.
If I need to post the .fla just let me know. Any assistance would be great!
Thanks,
cbs
Setinterval On Function
peepz,
i tried something with setInterval to disable a function for a few seconds, but is doesn't working:
ActionScript Code:
onClipEvent(load){
//set some vars in the this.
this.speedY = 0;
this.speedX = 0;
this.damping = .7;
this.easing = .2;
this.homeX = this._x;
this.homeY = this._y;
//higher is more sticky
this.stickiness=4;
//bounce prototype
this.blaat = function(){
this.onEnterFrame = function(){
//if the mouse is not over the box
if (!this.hitTest(_root._xmouse, _root._ymouse) or this.pressed == true) {
//then bounce me home
this.bounceMe(this.homeX, this.homeY);
this.pressed = false;
} else {
//otherwise, drag me with some friction
difX = this._parent._xmouse-this.homeX;
difY = this._parent._ymouse-this.homeY;
this._x = this._parent._xmouse-(difX/this.stickiness);
this._y = this._parent._ymouse-(difY/this.stickiness);
}
}
}
this.blaat2 = function(){
this.onEnterFrame = function(){
//then bounce me home
this.bounceMe(this.homeX, this.homeY);
this.pressed = false;
}
}
}
on(rollOver){
this.blaat();
}
on(release){
setInterval(this.blaat(), 1000);
this.blaat2();
this.pressed = true;
}
its a sticky button and onrelease it has to bounce back!
maybe somebody can give me some advise?
thnx,
robert
SetInterval Function
Hey guys,
I have a pretty simple question about the setInterval function (at least, I think it's simple). I am having a bit of a problem using it... I've never really used it before, and I'd much rather use it than do a frame count like I am usually doing.
Anyway, here's the code.
Code:
var ID:Number;
function tweenText() {
trace("pass");
var t1 = new Tween(this["cat"+i], "_alpha", Strong.easeOut, 0, 100, 50, false);
}
ID = setInterval(this, "tweenText", 2000);
basically, I want to run tweenText after 2000 milliseconds... Am I correc that this is what will happen? Am I using the correct structure?
-theonlycarmire
|