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




Clarification On SetInterval To Pause



I recently discovered via this forum how to use setInterval to pause the playhead, saving me thousands of empty cells in my timeline (thankyou).

I've used this successfully for a while, but now I have a file that seems to be ignoring my stop commands in frames. I know you are supposed to clearInterval.

On the first frame of the movie I have this code:

function pause(){
play();
clearInterval(timer);
}

Does this code mean that after the designated pause time, the movie plays and the setInterval is cleared?

Then where I want the movie to pause I have this code:

stop();
timer = setInterval(pause, 1000);

As I said this works most of the time, but recently I have started using some action script on the end of sound objects (narration) to start playing after the playhead is stopped with a stop() command.

So here is basically what I'm doing. I start the narration as a soundObject, during the narration I have several pauses using the setInterval method, then towards the end of the narration I put a stop() in a frame and use this code:

voice19.start(0,1);
voice19.onSoundComplete = function() {
play();
}

to start the playhead again. Only the stop() command is just being ignored.

I've spent days trying to figure this out and would appreciate any help.

thanks,
Dennis



FlashKit > Flash Help > Flash ActionScript
Posted on: 11-07-2005, 02:05 PM


View Complete Forum Thread with Replies

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

SetInterval Clarification/help
Hi guys, can you take a peek at this and tell me why the setinterval doesnt seem to be working. Im trying to call a function every few secs and also pass an object into that function, is this possible do you know.

what i need to do is within the enterframe of a movieclip call a function at random times (i know its not random at the moment but i can't seem to even get the setinterval to work)

Here's what i'm thinking:- cheers guys

var bubbling:Boolean=true;

function showBubbles(numberBubbles,tempObject) {
//Do something here
bubbling=false;
clearInterval(myInterval);
}

diver_mc.onEnterframe = function() {

if (!bubbling) {
myInterval=setInterval (showBubbles(10,Diver_mc),1000);

}
}

SetInterval And Pause
I am using setInterval with success, allowing for a timed delay to occur between the dynamic loading of jpgs. What I am now looking for is the methodology to 'pause' the setInterval and to then call it again to resume. The functionality is basically to allow for the 'pausing' of a timed slideshow and the 'continue' of the same slideshow based on button actions.

The code that I am successfully using is:

setInterval(runSlides,10000);

Where runslides is a function that is called.

Pause: SetInterval Help
I'm using the following code in a movie clip to do a slide show:

function wait() {
stop();
var myInterval = setInterval(function () { play();clearInterval(myInterval);}, 3.5*1000);
}

then I put a "wait()" action after every new picture. Everything works fine.

Now the problem is this. If I click on a button in the movie, bringing me to a new frame, the wait function is still working and will mess everything up. How do I cancel it?

Pause Then SetInterval
Hi there,
I'm trying to get an object to move to its left 1 pixel every second, after an initial 6 second pause.

So,
You press a button,
the object (panel_mc) moves 20 pixels to its left along its x axis,
then after 6 seconds (if nobody has pressed the button again)
the object starts to move to the right (along its x axis) 1 pixel a second.

- I can get the object to move the initial 20 pixels.
- I can also get the object to start moving to the left 1 pixel per second (after the button is pressed)


Code:
function goBack() {
panel_mc._x -= 1;
}
setInterval(goBack, 1000);
I'm stuck on how to pause for 6 seconds (after the button is pressed and before it starts moving back)

If anyone can help that would be great.

thanks

[F8] Pause SetInterval
Hi

Is there a way, to pause a 'setInterval' and then resume the setInterval, from where it was paused/stopped? I quess you would have to return the value of setInterval? Is that possible, or should it be done in another way?

I am creating a dias-show, and want to add a pause-feature.

Pause SetInterval
Hi, I have a question regarding the photo slideshow using XML and flash

(http://www.kirupa.com/developer/mx20...slideshow3.htm)

How can you create a button that will pause the slideshow? I can't find a way to stop the setInterval function once it's running.

Anyhelp would be greatly appreciated!!

Setinterval.please Pause
I did a search on this topic and tried a million things, I just can't get it to work.

I have an mc. in that mc there is a setinterval which should take it to frame 1 on the _root to be replayed. this should loop.


ActionScript Code:
stop();
function loopClip(){
    _parent.gotoAndPlay(1);
    clearInterval (this.intervalID);
    }
this.intervalID = setInterval( loopClip, 5000 );


but it doesn't want to delete the setinterval. which makes it go in a loop frenzy forever.
Please help!

~G

Pause With SetInterval Is Speeding Up
My problem is that my external swf are speeding up the second time you see it. I think it's the use of setInterval wich is making the movieclip speed up. Can anyone take a look at my coding? Is there a way to clear the interval in a frame before the "pause action frame" is played? I have tried to use clearInterval(myTimer); in a frame but this dosen't work. Is there another easy way to pause on a frame wich don't have this speed-up problem?


I have a external slideshow wich I load to my main stage using
(release) {
loadMovie("slideshow.swf", "_root.empty");
}

In this slideshow I use these actions
Frame 1: (fade in mc)
tellTarget ("_root.fade-in") {
gotoAndPlay(2);
}

Frame 2: (a pause frame)
stop();
function startAgain() {
clearInterval(myTimer);
play();
}
myTimer = setInterval(startAgain, 5000);

Frame 3: (fade out mc)
tellTarget ("_root.fade-out") {
gotoAndPlay(2);
}

Frame 4 to 19: nothing here, just leting the fadeout play to end

Frame 20 to 23 I use the same actions as in frame 1 to 3

Playing/pause With SetInterval
I am working on a project that starts playing when the file loads. There are play & pause controls on the interface - my trouble is when I first click pause it pauses properly, or more accurately - clearInterval. When I try to restart it, it doesn't seem to reset the interval.

Here is my code:


Code:
this.pause_btn.onPress = function() {
clearInterval(inter);
trace('paused');

}

this.play_btn.onPress = function() {
delay = 5000;
_root.playMe(delay);
trace('playing');
}

function playMe(delay) {
counter = getCounter();
inter = setInterval(displayData, delay, counter, 'forward');
trace('playing');
}

this.playMe(delay);
So when the file loads, playMe() runs every 5 seconds. Clicking pause_btn, clearsInterval which stops playing. When I click the play_btn, it does not triiger the playMe function - not even a trace is displayed.

Any thoughts?
Thanks
Rich

Pause Effect Using SetInterval
I'm currently developing a game in FlashMX and I'd like there to be a pause of a few seconds before a button/character becomes active/clickable. Instead of adding a load of frames to create the effect, I'd like to use actionscript to create the pause. I know that this should be possible using setInterval function, but all the tutorials I've found are usually in a different context or don't explain where or on what the script should be put.

Thanks - Jessie

Pause Prototype / No Setinterval
Hi all...
i think ive asked this before but I couldnt find the thread.... what I need is a pause prototype....not setInterval. Have any of you find a good prototype for this or know a function for this??

This is what id like to do:

pause=function(time){
blah blah blah
}

blah = function(obj){
tween something......
pause(10)
tween something else....
}

blah()

Thanks for your help...

Pause (or Delay) With SetInterval
Hi!

Anybody knows how I can the following?

I want to perform an action, and after a period of time (one or two seconds)
do another one, and after one or two seconds a last action too. For example:

1. mainmc._xscale = 250
mainmc._yscale = 250

(wait two seconds)

2. mainmc._rotation = 45

(wait four seconds)

3. mainmc._alpha = 50

I tried the following script and works only one time, when I try to do it again doesn't work:


pause = setInterval(function () {


mainmc._alpha = 50


clearInterval(pause);
}, 1000);

pause = setInterval(function () {


mainmc._rotation = 45

clearInterval(pause);
},900);
pause = setInterval(function () {


mainmc._xscale = 250
mainmc._yscale = 250

clearInterval(pause);
}, 800);

SetInterval To Pause Movie
Hi,
I want to make use of the setInterval function so that the movie pauses for a while and then after 15 seconds it goes to another frame. I have tried the following codes but did not seem to work. I cannot use getTimer because it jumps from Scene 1 straight away to the desired frame, without pausing (because of the onEnterFrame).
Kindly advise.
U







Attach Code

//timeline pauses for 10 seconds
var nInterval:Number = setInterval(doAction, 7000);
function doAction():Void {
}

//Is the code below valid
if (setInterval(nInterval)>7000) {
gotoAndStop("hand");
clearInterval(nInterval);
}

Pause Playback (setInterval?)
Hi all, I have a very straight forward piece I'm working on that involves copy fading in and out but, instead of using the time-line for timings I'd like to use some script. Can anyone help me out?
It's just copy fades in (hold for three seconds) then fades out (hold for one second) copy fades in (hold for three seconds) etc...

How To Pause An Functin With Setinterval And Play Again?
Little bit stuck here, I call a function changePhoto with setInterval.

Furthermore I got two buttons (pause and play)

Now with pause I just clearInterval and with play I want to start where
changePhoto has been stopped???


ActionScript Code:
nav_mc.pause_mc.onRelease = function(){    trace("Pause this "+pIndex);        clearInterval(playID);    nav_mc.play_mc._visible =true;    this._visible = false;}nav_mc.play_mc.onRelease = function(){    trace("Play this");    play();    nav_mc.pause_mc._visible =true;    this._visible = false;}playID = setInterval(this, "changePhoto", 4000, 1);

SetInterval For A Pause In Screens Class
Some with the setInterval - trying to integrate a 10 second pause within the onFocus behavior. Slide loads/focuses, audio plays, onto the child screens.



ActionScript Code:
on (focusIn) {
 
setInterval(gotoNextSlide,10000)
    //Load Streaming mp3 behavior
    if(_global.Behaviors == null)_global.Behaviors = {};
    if(_global.Behaviors.Sound == null)_global.Behaviors.Sound = {};
    if(typeof this.createEmptyMovieClip == 'undefined'){
        this._parent.createEmptyMovieClip('BS_vo1',new Date().getTime()-(Math.floor((new Date().getTime()) /10000)*10000) );
        _global.Behaviors.Sound.vo1 = new Sound(this._parent.BS_vo1);
    } else {
        this.createEmptyMovieClip('_vo1_',new Date().getTime()-(Math.floor((new Date().getTime()) /10000)*10000) );
        _global.Behaviors.Sound.vo1 = new Sound(this.BS_vo1);
    }
    _global.Behaviors.Sound.vo1.loadSound("audio/1.mp3",true);
      // GoTo Next Screen behavior
      var screen = null;
      var target = this;
      while((screen == null) && (target != undefined) && (target != null))
      {
        if(target instanceof mx.screens.Screen)
        {
          screen = target;
        }
        else
        {
          target = target._parent;
        }
      }
      if(screen instanceof mx.screens.Slide)
      {
        screen.rootSlide.currentSlide.gotoNextSlide();
      }
      // End GoTo Next Screen behavior
 }


Any ideas? Thanks

Pause And Play Cuepoint With Setinterval
I am try to set an interval so when intervalID = setInterval(interval, 1000, infoObject.name); is fired at each cuepoint name i.e na1 etc the FLV is paused.

Is this the best way, or is there a better way to do this?
thanks


Code:


var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
display.attachVideo(ns);
ns.seek(0);
ns.onCuePoint = cuePointHandler;
ns.setBufferTime(20);
display.smoothing = true;
ns.play("filmstrip18new31.flv", 0, 100, true);
//every 500ms execute the function checkLoaded with param = stream_ns
var loaded_num:Number = setInterval(checkLoaded, 500, stream_ns);
function checkLoaded(my_ns:NetStream) {
//calculate the percent loaded
var percentLoaded:Number = Math.round(ns.bytesLoaded/ns.bytesTotal*100);
trace(Math.round(ns.bytesLoaded/1000)+" of "+Math.round(ns.bytesTotal/1000)+" KB loaded ("+percentLoaded+"%)");
if (percentLoaded>=100) {
clearInterval(loaded_num);
}
}
//loop FLV when completed
ns.onStatus = function(info:Object) {
if (info.code == "NetStream.Play.Stop") {
ns.seek(0);
ns.play();
}
};
// create 12 buttons and attach them to a cuepoints.
ns.onCuePoint = function(infoObject:Object) {
var id:String = infoObject.name.substr(3);
var mc:MovieClip = attachMovie("but", "but"+id, Number(id)+1);
intervalID = setInterval(interval, 1000, infoObject.name);
trace("but"+id+" "+infoObject.name);
mc._x = 212;
mc._y = 227.3;
if (infoObject.name == "finish") {
trace("completed loop");// when loop is complete set Number(id) type function to 0
}
_root["but"+id].onPress = function() {
trace("this button : "+id+" "+infoObject.name);
trace("---------");
ns.pause();
};
};

//pause FLV for a second and replay through after setInterval
function interval() {
ns.pause();
}

Stop Button Used With SetInterval Pause Technique
To control the length of my timeline, I use a pause script that I got from this board; looks like this:

Code on first frame of my movie:

function pause(){
play();
clearInterval(timer);
};

Code on various frames down the timeline where I want it to pause:

stop();
timer = setInterval(pause, 2000);

The above works great for me.

I want people to be able to pause and start the movie with the space bar, so I put over the whole stage a MC that will do this. this MC has two frames with a big invisible button on each frame and a stop command on each frame. Frame 1 button code:

on (release, keyPress "<Space>"){
_root.clearInterval(timer);
_root.stop();
this.play();
}

this.play sends MC to second frame where the second button is with this code:

on (release, keyPress "<Space>"){
_root.play();
play();
}

This works a couple of times, but then stops working. Any ideas why? Open to easier way to do this, but I would like to have users just be able to use the space bar.

Thanks.

Override SetInterval To Pause Movie Timeline
Hi -
I have a movie timeline that plays a continuous loop. I have added several delays to allow the user to read blocks of text before the animation continues. I want the user to be able to stop the presentation at will. The delay works fine, but I simply cannot get the presentation to pause.

delay script on frame-

function wait() {
stop();
var myInterval = setInterval(function () { play();clearInterval(myInterval);}, 4*1000);
}
wait();

code on stop button

on (release) {
clearInterval(myInterval);
stop();
}

If I change it to this it works

on (release) {
clearInterval(myInterval);
gotoandPlay("intro");
}

but I dont want it to go anywhere. I just want the main timeline to stop.
AARRGGHH!
Any help would be greatly appreciated!!!

Pause/Resume Slideshow Using SetInterval/clearInterval?
Hello,

I promise I did a big search on this topic, and I have a few books on hand, but this seems to be beyond what I know, which isn't all that much!

I'm trying to get my slideshow to "pause" and "resume" on mouse actions--rollOver to pause, rollOut to resume, click to go to another URL or another frame (not yet decided which, but I want to display the contact info when one clicks an image). I also have it set to show the "captions/descriptions" of each image on rollOver.

Each image is placed in its own frame, with this AS to give each image 2 seconds to show, with description on rollOver. This works so far:

ActionScript Code:
stop();var interval:Number = setInterval(function () { play(); clearInterval(interval);}, 2000);


I have all the images as buttons, and the descriptions are hidden unless the images are rolled over.

What I want to do is to pause the slideshow as long as the mouse is over the image (i.e, the user can view the image longer than the interval is set), and resume where it left off (I suppose going to the next image is just fine).

Initially, I very much wanted to have a "controller" of sorts to show up upon rollOver (but hidden otherwise), with which the user can skip forward or back instead of waiting for the entire show to run its course. Since I can't even figure out the pause/resume issue, I figured I'd keep it simple. However, I'd appreciate any input regarding making this happen, as well.

I'm attaching my test Fla here. It's entirely possible that I'm pursuing this using a wrong method, but setInterval is the only way I knew how to not resort to designating tons of frames per image.

Thank you in advance for any help--I appreciate your time!

Clarification...
Just figured I'd post a message to clarify my last request... I have a movie clip, two attached panoramic images that are "background" objects, so to speak... I have them tweened to scroll from one end of the canvas to the other, then on the loop, the cycle restarts. I'm looking for a way to control the direction that they scroll via keyboard input, ie, a user presses the left key, the movies stops it's present motion and reverses, press the right key, well, you know... I have a pretty decent grasp on Flash scripting and I see my answer having something to do with the goto and play previous frame, though I cannot seem to iron out a plan of attack on this one. Please feel free to email if you can help, graphon@elite-expressions.com.

Thanks again,
Dan

A Little Clarification, Thanks...
Hi,

If I am to have .jpg images load dynamically into an empty movie clip.

Is it so that within the coding of my next & back buttons, I need to indicate each & every .jpg title so it will be aware...as well as indicating the instance name of the empty movie clip?

For example, within the code on those buttons, include: "image01.jpg", "image02.jpg", "empty_mc" so on and so forth?!

Thanks!

Christine

Coding Clarification
Hello all,

I was wondering what the following meant:


Code:
/:selection = ../:_name;


Isn't this just telling the movieclip 'selection' to be equal to the previous mc called name? I guess what is confusing me is the slashes. I'm used to writting code with _root and _parent and seem to get confused when trying to learn from code like this.

Thanks for your time,

Ok I Got Clarification Now I Need An Explaination
ok I my last post I asked what a Preloader was thanks for the answer from that guy I know.

Now I need to know how to make a PRELOADER

1) what is that code behind it
2) how do I build it

thanks alot for all the help thus far need a bit more thanks

[edit]footer removed - please read the guidelines in the FAQ. thanks![/edit]

Clarification On Timelines
Hey guys, I'm new and just learning ActionScript. I've been reading tutorials and sources from a bunch of different places and so I just wanted some clarification on some code.

There is an instance (named ball) of a movieClip object on the stage:

Block 1:

Code:
ball._x = 100;
ball._y = 100;

ball.onEnterFrame = function()
{
this._x += 5;
}


Block 2:

Code:
ball._x = 100;
ball._y = 100;

function onEnterFrame():Void
{
ball._x += 5;
}


Both of these bits of code seem to do the same thing on the screen, so here's my question. Are they both affecting the same timeline? From Block 2 it's clear to me, that it's affecting the root timeline, but when looking at Block 1 I can interpret it two ways:The ball object is handling the enterFrame event of the root timeline.Since ball is itself a movieClip, it is affecting it's own timeline (because movieClip objects have their own timeline, right?)So which is the correct way of interpreting the code?

And if ball is handling the enterFrame event of the root timeline, how can I get ball to handle the enterFrame even of it's own timeline?

Thanks guys.

[CS3, AS2] Quick Clarification
Should i be using this code EACH AND EVERY TIME i perform some tween action??

Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;


Example, i am using the above two lines of code in frame#2, before i make some tween., and then i am going to make some tween in frames 6 and 9, and then later inside some of my MC's... so each and every time do i have to import tween class before initiating a tween?? Is it possible i just import the tween ONCE for all??

[F8] [AS2] Need Clarification On Using Objects
I'm a little new to Objects, though I've probably made use of them unbeknownst to me... I need a little clarification about some scripts I've been using and how to improve.

When I create a movieclip this way, is it just storing a string reference to the clip in "clippy" or is "clippy" essentially an object (though not declared)? :

var clippy = this.SCROLL_CARDS.viewer_mc.content_mc.createEmpty MovieClip("SLOT" + i, jj++);

I want to change the way I track this clip, via an object I already have. I fetch the object out of my array like this:

obj = my_cards[i];

How would I assign the movieclip (either at creation time, or after) into the object for easy reference later?

Font Clarification
I must admit I've been away from flash for a few versions. I've had to catch up pretty quickly this month. I have a quick few questions regarding fonts.

1. If I embed a font into one movie and load it into the main movie, will it be available to use in any text field I wish to apply it to?

2. To reference a font loaded in using the above method, should I use its linkage name or the full font name or do I have to reference it from within the movieclip it is embedded in?

I hope this makes sense.

Chris

Clarification On SWF Files
Hi, having an FLA file which holds init script which react differently between one user and another (for example: an asp which holds an SWF file which decides what content to bring from DB according to the user - Personalization) refering to the SWF file:
does the SWF file holds in it script? when i imported swf file into a new FLA file i didn't see any script BUT since the file is personalized i know there is something in there... is there a way to get to it?

Thanks in advance,
Maya.

Clarification On Doing A Killing...
deleting, killing objects and functions.

There seem to be a few different ways to achieve to completely get rid of unwanted objects and functions(which are in turn objects as well, no?)

Just to refresh:

objects:

Code:
object = undefined // does the job
object = null // does the job
exception: if the object is referenced anywhere else in the application, the object is still in memory, unless the object's reference is killed as above.
also: if you attempt to try cleaning up and object , which has objects itself, (e.g. object.subObject = new Object()), then those subObjects are still alive.

To properly clean up the object with subObjects, the subObjects have to be killed off seperately.

Am I right so far?

I am just writing this, because, yet again despite quiet some experience by now I had some setIntervals running in some objects, and they somehow kept appearing somewhere, because again somewhere, I didn't clean up the intervals and accompanying objects.

Can anyone comment on the above being right/wrong, best practice, etc.
Please be detailed, tell me in machine code if you must.
Mainly developing interactives for exhibition spaces which have to run for hours, memory leakage, is something not everyone has to take that serious, yet I do.

Cheers,

uncleunvoid

GetURL Clarification
Im a newbie in flash. Im trying to make my buttons open a different local URL when they are clicked. I want them to open in the same window. I have tried using the code: getURL("boutUs.html",_self) but it doesnt open in the same window instead it opens the link in same window but in a tab. I want it to overwrite the current window that is open. Can someone please help me. Sorry if thsi is astupid question

Clarification Regarding Broadcast
We are doing a project in Flash of developing an elearning application.In this project we need a solution for how to broadcast stored/prerecorded video through flash media server.We ve done live video broadcast using web camera but we ae not able to for the stored video. Please help us if u can.

Need Basic OOP Clarification
I've created a button graphic in the Flash IDE called buttonBar. In my document class (called Main.as) I've instantiated several versions of the button. I also added an event listener to test some basic functionality on the first button.
Everything works fine, but I suspect I'm adding too much to my document class & constructor function. I feel like I should create a Button class that will dictate how the button behaves when rolled over. The question is, would the button class handle the event listening for itself(within the Button.as file), or should all event listeners be run from the document class.







Attach Code

package com.joeMusella {

import flash.display.Sprite;
import flash.display.MovieClip;
import flash.events.MouseEvent;



public class Main extends Sprite {

private var _btnBarHome:buttonBar;
private var _btnBarBio:buttonBar;
private var _btnBarNews:buttonBar;
private var _btnBarGear:buttonBar;
private var _btnBarMusic:buttonBar;
private var _btnBarContact:buttonBar;

private var _buttonWidth:Number = 117;
private var _buttonHeight:Number = 31


public function Main () {

//-----------------------------------Instantiate buttons---------------------------------------------------------



_btnBarHome = new buttonBar();
addChild(_btnBarHome);
_btnBarHome.x = 155;
_btnBarHome.y = 345.4;
_btnBarHome.width = _buttonWidth;
_btnBarHome.height = _buttonHeight;

_btnBarBio = new buttonBar();
addChild(_btnBarBio);
_btnBarBio.x = 292;
_btnBarBio.y = 345.4;
_btnBarBio.width = _buttonWidth;
_btnBarBio.height = _buttonHeight;

_btnBarNews = new buttonBar();
addChild(_btnBarNews);
_btnBarNews.x = 426.6;
_btnBarNews.y = 345.4;
_btnBarNews.width = _buttonWidth;
_btnBarNews.height = _buttonHeight;

_btnBarGear = new buttonBar();
addChild(_btnBarGear);
_btnBarGear.x = 562.1;
_btnBarGear.y = 345.4;
_btnBarGear.width = _buttonWidth;
_btnBarGear.height = _buttonHeight;

_btnBarMusic = new buttonBar();
addChild(_btnBarMusic);
_btnBarMusic.x = 700;
_btnBarMusic.y = 345.4;
_btnBarMusic.width = _buttonWidth;
_btnBarMusic.height = _buttonHeight;

_btnBarContact = new buttonBar();
addChild(_btnBarContact);
_btnBarContact.x = 832.6;
_btnBarContact.y = 345.4;
_btnBarContact.width = _buttonWidth;
_btnBarContact.height = _buttonHeight;


//---------------------------------Button Functionality-----------------------------------

_btnBarHome.addEventListener(MouseEvent.ROLL_OVER, onBtnRollOver);
_btnBarHome.addEventListener(MouseEvent.ROLL_OUT, onBtnRollOut);
}


private function onBtnRollOver(event:MouseEvent):void {
_btnBarHome.width = _buttonWidth * 1.1;
_btnBarHome.height = _buttonHeight * 1.1;

}

private function onBtnRollOut(event:MouseEvent):void {
_btnBarHome.width = _buttonWidth;
_btnBarHome.height = _buttonHeight;
}

}

}

Basic Clarification
Think this is probably dead simple but I cant get my head round it.
In the first frame of a movie I call:

new com.jj.core.Application();

I want my Application class to create some empty movie clips to use as containers and then add them to the stage. I declare a static var (containerVar) to store the container reference in and call a method of my Application class that should create the clips themselves:

private function createClips():void
{
containerVar = new MovieClip();
addChild(containerVar);
}

This comes back saying that addChild is an undefined method and the only way I can get it to work is by passing a reference to Application through the constructor and then calling addChild on this reference:

new com.jj.core.Application(this);

private function createClips():void
{
containerVar = new MovieClip();
passedRef.addChild(containerVar);
}

Is there any way of getting a reference to the main timeline (like AS2 _root) or is the way I described how it has to be done these days?

Also, if anyone feels like explaining a bit about AS3s 'root' and 'stage' properties or knows of some good material on them I would love to get a better idea of how they work.

Cheers all

'compc' Clarification, Please
I am a little confused about syntax for the command-line component compiler, compc. Let's say I would like to build a .swc library from the following packages:

components/directory1/package1.as
components/directory1/package2.as
components/directory2/package3.as
components/package4.as

What necessary compiler options should I include? Could someone give me an example compc command based on the above package tree?

Thanks

LoadMovie Clarification?
I'm just getting into the "loadMovie" thing and after searching books and this forum on the "how-to's" I must misunderstand something...

I'm just trying to load into a target MC a one-framed purely AS driven .swf. The target MC is the exact size of the .swf. When the .swf loads there's no AS interaction as there is in the original .swf... it just sits there. Any way to loadMovie an .swf and keep all it's little AS effects?

Follow my question? oh yeah and is there anyway to keep a loadedMovie from looping?

Quick Clarification On [AS]
Hey.

Just need a small clarfication on this [as].
Decription: On the first frame consists of LoadNumVar

Code:
loadVariablesNum("C:/Documents and Settings/Owner/Desktop/text1.txt", 0);
If Statement:

Code:
if (text ne "") {
gotoAndStop("end");
}
I know whats happening but what is (text ne "") ?

Class Clarification
Ok, I just had a few things I need clarified.

1. I can have one public class per package?
2. package "name" { ... "name" refers to directory? Because I tried giving my package a name and got an error.
3. When extending a class, say we have class Shape {
and I want to extend class Square {
I would then create a... var myShape:Shape = new Square(12);
or var myShape:Square = new Square(12);

Anyhow, those are some things I'm not understanding right now. Thanks if you get help me, I've been going through the help files and I'd like to get past some of this stuff so I can get on to the better stuff.

Need A Little Clarification On The Embed Fix
Hello all,
I found the page on "fixing the flash embed issue" and am going to implement it in my already built site. My site has many pages all with a common flash navigation menu at the top and some with an additional Flash animation below. All pages also have a lot of HTML, I mean it's not an all flash web site.

I built the site in Dreamweaver and all the flash movies are already put in them with, what looks like, the embed code that I assume Dreamweaver generates.

Do I need to strip code out before putting the new code (generated by the flash object generator) into the page?

All my flash movies are in 1 folder, but the HTML pages are in multiple folders. The fix page says to put the flashobject.js in "the same location as your HTML page that will display your Flash animation." Does that mean one instance of the flashobject.js file for each page or one instance of it in each folder of pages, or something else??

Being fairly new to this, I'm really afraid of this turning into a nightmare.

Any help, direction, or advice will be VERY much appreciated.

Best regards, Scott

CacheAsBitmap Clarification
Hey all,

So just a quick question about the cache as bitmap property.


If i have a movieclip that contains another movieclip which is an animation in it.

So Mov1 -> Mov2 -> 8 frames of .png files.

If i set Mov1.cacheAsBitmap = true, and then play the animation in Mov2. Is the whole thing still cached as a bitmap?

I'm just trying to figure out when i'd need to reapply a cacheAsBitmap property. Does it ever revert back to false by performing some sort of action on the movieClip?

Thanks!

[AS 2.0] Var Definition Clarification
hey guys:

what, functionally, is the difference between:

Code:
var someVar:Number;
and
Code:
var someVar:Number = new Number();
i'll sometimes use them interchangably in a script without any seeming ill effect, so i just wondered what the difference was from a functional point of view. and yes, it's late and i'm waxing philosophical... must be the flat Coke Zero...

one thing i do know, is that the second version allows you to set some properties right off the bat, rather than use a second or third line to do it:

Code:
var someOtherVar:String = new String('bananas');
... but other than that... ?

danke mein volks!

WR!

LoadMovie Clarification?
I'm just getting into the "loadMovie" thing and after searching books and this forum on the "how-to's" I must misunderstand something...

I'm just trying to load into a target MC a one-framed purely AS driven .swf. The target MC is the exact size of the .swf. When the .swf loads there's no AS interaction as there is in the original .swf... it just sits there. Any way to loadMovie an .swf and keep all it's little AS effects?

Follow my question? oh yeah and is there anyway to keep a loadedMovie from looping?

Quick Clarification On [AS]
Hey.

Just need a small clarfication on this [as].
Decription: On the first frame consists of LoadNumVar

Code:
loadVariablesNum("C:/Documents and Settings/Owner/Desktop/text1.txt", 0);
If Statement:

Code:
if (text ne "") {
gotoAndStop("end");
}
I know whats happening but what is (text ne "") ?

Functions Clarification
Last edited by r_bartoli : 2004-12-13 at 14:19.
























Hi all. I've some code like this and it works.


ActionScript Code:
// myData
var myData:LoadVars = new LoadVars();
myData.load("view.asp");
myData.onLoad = function(bSuccess:Boolean) {
    if (bSuccess) {
        var NumRowX:Number = 5;
        var NumRowY:Number = 20;
        McRowProperties = new Object();
        // Db records
        for (var i = 0; i < this.cant; i++) {
            McRowProperties._x = NumRowX;
            McRowProperties._y = NumRowY * i;
            McRowProperties.TxLink_txt = myData["Link" + i];
            attachMovie("McRow", "McRow" + i, i, McRowProperties);
        }
    }
};


I need to add some functionality: I want to control the time of the attachMovie function. But it doesn't work. I'm 99% sure that it depends on the i var.


ActionScript Code:
// populate function
function populate() {
    McRowProperties._x = NumRowX;
    McRowProperties._y = NumRowY * i;
    McRowProperties.TxLink_txt = myData["Link" + i];
    attachMovie("McRow", "McRow" + i, i, McRowProperties);
}
// myData
var myData:LoadVars = new LoadVars();
myData.load("view.asp");
myData.onLoad = function(bSuccess:Boolean) {
    if (bSuccess) {
        var NumRowX:Number = 5;
        var NumRowY:Number = 20;
        McRowProperties = new Object();
        var intervalID:Number;
        // Db records
        for (var i = 0; i < this.cant; i++) {
            intervalID = setInterval(populate, 500);
        }
    }
};

Clarification On Timelines
I just wanted some clarification on the following bits of code. There is an instance (named ball) of a movieClip object on the stage:

Block 1:
Code:

ball._x = 100;
ball._y = 100;

ball.onEnterFrame = function()
{
    this._x += 5;
}

Block 2:
Code:

ball._x = 100;
ball._y = 100;

function onEnterFrame():Void
{
    ball._x += 5;
}

Both of these bits of code do the same thing on the screen, so here's my question. Are they both affecting the same timeline? From Block 2 it's clear to me, that it's affecting the root timeline, but when looking at Block 1 I can interpret it two ways:The ball object is handling the enterFrame event of the root timeline.Since ball is itself a movieClip, it is affecting it's own timeline (because movieClip objects have their own timeline, right?)So which is the correct way of interpreting the code?

And if ball is handling the enterFrame event of the root timeline, how can I get ball to handle the enterFrame even of it's own timeline?

Thanks guys. (Sorry for all these random questions. I'm reading from various sources.)

LoadVariables: Usage Clarification
I've kinda got the overall usage, but can't quite get it to work right.

In _level4 I have a button action that does

loadVariablesNum ("content.php", 0, "POST");

This send all variables in _level0 to content.php, correct?

Then, in _level7 I have a text field with the variable "body", which is one of the variables that content.php returns, in a movie clip named "container".

I've tried a couple different things at this point...

frame 1 does loadVariables ("content.php", _root.container);

Then tried moving the text field to the _root level and frame 1 to:
loadVariables ("content.php", _root);

Then changed the text field name to _level0.body and removed loadVariables, thinking that the initial button action also simultaneously loaded the variables from the php into level 0.

Basically, I'm very confused on what does what and tutorials are confusing me even more! Please, for my sanity help me find my way!
;p
Thanks!

MC Link Code Clarification....
Have an MC, it animates when one rollsover it with the mouse.

I need it to now link to another webpage within this site if someone clicks on the same animated MC.

On the last frame of the animated MC, on the invisible button,
I have:
on (press){
_root.gotoAndPlay("portfolio");
}

That animates but it doesn't transition to the corresponding webpage within the site?!
Why? (portfolio is the frame label name of the page it needs to transition to when the MC is clicked upon)

Many thanks!

Confusion...I'm In (dis)array....some Clarification Please?
i'm not very familiar with the use of arrays, however i have found myself in a spot where i need to use one (i think). I'm trying to condense my code, which is easily done using "for" loops, but i need to add labels to buttons through AS, and i think that an array is the best way of doing that (if i'm wrong...please correct me and save me from another headache!)

Let me see if i can explain...I have a series of mc's (buttons) and each button contains an empty dynamic textfield. i need to label each button through AS. I used for loops to assign events to the buttons, but how do i label them in a similar fashion.

For example, let's say my button code is the following:
Code:
for (i=1; i<6; i++) {
theButton = _root.menu["but"+i];
theButton.thisNum = i;
//
theButton.onRollOver = function() {
_root.menu["but"+this.thisNum].gotoAndPlay("over");
};
//
theButton.onRollOut = function() {
_root.menu["but"+this.thisNum].gotoAndPlay("out");
};
//
theButton.onRelease = function() {
if (_root.section != _root.menu["blah"+this.thisNum]+".swf") {
_root.section = ["blah"+this.thisNum]+".swf";
_root.transition.gotoAndPlay("end_of_example");
}
};
}
the textfield contained within the buttons has the instance name btnLabel . if i was to use an array to label the buttons, from the tutorials i've worked my way through, i would define the array like this:

Code:
btnLabels = ["blah1","blahblah","blah1blah","test","testblah"];
//or
Labels = new Array();
Labels[0] = "blah1";
Labels[1] = "blahblah";
Labels[2] = "blah1blah";
Labels[3] = "test";
Labels[4] = "testblah";
//
//
// I TRIED THINGS USING EVERY COMBINATION OF THESE ELEMENTS (not nec. all together, but bits and pieces of this mess)
theButton = _root.menu["btnLabel"+this.thisNum].text = ["Labels"+i];
// BUT THAT SURE AS HELL DIDN"T WORK
should the name of the array be the same as the instance name of the text box??? how do i assign the value of the first element in the array, to the the textbox in the 1st button, the 2nd element, to the 2nd button, etc

if i were to write it out the long way, it would look like this":
Code:
_root.menu.but1.btnLabel.text = "blah1";
_root.menu.but2.btnLabel.text = "blahblah";
_root.menu.but3.btnLabel.text = "blah1blah";
_root.menu.but4.btnLabel.text = "test";
_root.menu.but5.btnLabel.text = "testblah";

Volume Slider Clarification
...Sorry to bug you again, it's just that my concern is fairly urgent: What I purpose is creating a volume slider that doesn't just work with background music, but also with sounds that are produced when (for example) clicking on buttons (etc.)
Thanks for taking the time!

Original message:

Quote:




Hi, Just created a nifty Flash-presentation, featuring all kinds of classy effects and sounds. It holds a number of movie-clips and buttons, all/most of them feature attached sounds. NOW that I'm finally (almost) done, I am thinking of adding a volume-slider, which appears to be a major problem: all of the tutorials I've come across so far deal with volume sliders which you have to additionally attach the sound to. Is it at all possible to create a slider that simply responds to the sounds that already exist in your .swf-file? THX!

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