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




Adding Up Score From Movieclip To Scene



Hi, I am doing a quiz game project using flash that is due soon. I am having a bit of problem with adding up score from many movieclips and displaying it on another scene.


Any help is deeply appreciated.Thanks in advance.



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 05-07-2007, 07:19 AM


View Complete Forum Thread with Replies

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

Copying Game Score From Scene To Scene
Hi:

I've created a game that involves 10 questions. Each question is in its own scene. I've been racking my small brain trying to find a way to copy the user's score from scene to scene and add (or deduct) points based on whether the user answers the question correctly or incorrectly.

Any ideas or places to go to check out some sample script? Or am I missing something obvious.

Thanks.

Happy New Year

Tim

Adding A Score
Im creating a quiz and i want to add a score to it?
What do i have to do to put in a score?

Thanks for the help that you will be able to give?

Help With Adding Score?
I'm moving along in a tile game I'm working on. Clicking groups of similar-colored tiles removes them from the board. I want a user's score to increase when this happens. What I thought would be an easy solution has me confused now.

I'm creating everything dynamically. I've declared textfield as a new Textfield. I've declared a variable for the score. My code, which I thought would do the trick:


Code:
private var textfield:Textfield = new Textfield;
private var score:int = 0;

private function _clickHandler(event:MouseEvent):void {
beep.play();
_markedTiles=new Array ;
for each (var tile:Tile in _markedTiles) {
_remove(tile);
_userScore(event);
}

private function _userScore(event:Event): void {
textfield.x = 213;
textfield.y = 18;
textfield.background = true;
textfield.autoSize = TextFieldAutoSize.LEFT;
textfield.text = score;
score+=10;
}
Anyone have any ideas?

Adding To A Score
ok I have my main flash file and that is loading in 2 seperate swf files, one of these holds the score text box and the other holds a button. I want to add a value to the score when the button is clicked.
Have tried various forms of actionscript such as

on (release)
{_root.score = _root.score+10;}


but these don't work when using seperate swf files

does anyone know a way to do this?

From A Score To A Scene
I just did the flash 5 arcade tutorial and found that it was rather helpful. So, i went on. I added some nifty new units and an introduction. The only problem is, I only have one level. Why? because I don't know how to write in actionScript 1,

if score > or = 500000
then gotoAndPlay Scene 2

PLEASE HELP!!!

Going To The Next Scene At A Certain Score
hey, im currently making a fps game and im having trouble making it play the next level, i want it to go to the next scene when your score reaches 1000, could somebody please post suggestions and maybe explain how it works? thanx alot!

Adding Points To Your Score?
I'm making a shooting game and i was wondering how you could add points to your score when you shoot whatever you are shooting at. I figure that you have to make a button that "on (press)" somehow it will add points to your score which will be at the top. Anyone know how to do this?

P.S. I'm using Flash 8

[CS3] Problem With Adding A Score
hi,
this is my first time using both this site and Flash,
im trying to make my first game and ive come to a problem and couldnt solve searching the web
i have a working score, but i wanted, when the character dies, to show a score summary, showing "enemy1 killed = 17
enemy2 killed = 4
etc. "
to do this i just used the working score and basically added a number on the end to make a new score;

function updateScore(points)
{
score += points;
_root.scoreText.text = score;
}
function updateScore1(points1)
{
score1 += points1;
_root.scoreText1.text = score1;
}

I then made points1 equal 1 whenever enemy1 died which should give the results i want, but for some reason when ever anything is added it gives the value "NAN".

Can anyone explain why?

P.S. Another problem i have is making my dynamic text disappear until the character dies;
i read somewhere that this;

{ _root.scoreText.text._alpha = 0}

should make the text transparent, but it does not (I was hoping to replace "0" with "x" and on function "gameover" make x=100, making the text transparent).


P.P.S.

is it just me or is this website really really reeeaaaallly slow??

Total Score Not Adding Up...
I've made a game where the you catch things that each have their own individual score, when you catch one, a card appears showing details of that thing (displayClip). In this displayClip there is a dynamic text box that has the amount that the thing is worth for the score. This then gets sent to to final score. Everything is working just how it should EXCEPT for the fact that the amount just get's exchanged with the last amount, not added to it ?!?! I thought " score += Number(a); " would do it... any one with an idea of why it is not adding up? Would very much appreciate any help.

var displayClip = attachMovie(thing.style, thing.style, d);
var a = displayClip.amount.text;
var score = 0;
score += Number(a);
total.text = score +" kr.";





























Edited: 05/19/2007 at 10:31:47 AM by einnep

Adding Score And Timer
I have looked around for tutorials to add a score and timer to my game. I have added the score ok but can't sus the timer. I want it to affect the score at the end of the game/level.

Can anyone point me in the right direction?

Maybe another problem is that the level doesn't actually end at the moment - when you do all the tasks it doesn't finish - haven't sused that either.

:s

I am new to this so would like to be pushed in the right direction rather than just having someone write some code. I want to understand what I am doing wrong.

Thankyou for your time

Score Sends To New Scene
Hey, all.. I'm having a problem (isn't that why most people post here?

Anyways, I'm trying out my hand at scripting a game through Actionscript. I've got my two levels working independantly, but I can't get it to move from level one to level two! Here's the code:

if (this.hitTest(_root.ship)) {
_root.gotoAndStop("gameOver");
} else if (score>=200) {
gotoAndPlay ("Scene 2", 1);
}

The first part is working, killing the player when hit, but the second part (The else if) doesn't work.

score is the variable assigned to a dynamic text box.

Thanks in advanced,
Kim

Load Score From One Scene To The Next
I have the dynamic text area named "score". I have: score=0; in the first frame of my first scene, scene 1 is called Level1.

Here's my guess:
score=LoadVars("Level1","score");

but it doesn't work.

Thanks for looking

[f5] Problem With Adding Score Properly
Hi I have a problem with my flash game. i was wondering if anybody may be able to give us some help on where we are going wrong.
Im using flash mx with actionscript 1.

Basically there are these pigs that fall from the top of the stage, into a bucket. Every time a pig touches a bucket the user gets a point.

We created 1 pig and duplicated it using the duplicateMovieClip, in a for loop. The duplication is working fine but unfortunately score is only added when the original pig touches the bucket, and when the pig does touch the bucket, it doesn’t add 1 point to the score, it keeps adding till the pigs passes past the bucket.

We created a variable for the score that displays in a dynamic text field.

Here is the code on the main stage:


Code:
//variable where score is kept
var score=this.score_txt.text;
//initialise the score

score=0;

//bucket, so that the pigs are behind the bucket
bucket_mc.swapDepths(100);

//create 5 additional good pigs
for(var i=0;i<5;i++){
piggy_mc.duplicateMovieClip("piggy_mc"+i,i)
}

//TIMER COUNTDOWN FROM X SECONDS

var countDownTime = 30; // Number of seconds
countDown = function () //start of function
{
if (countDownTime != 0) //if time is not equal to zero
{
--countDownTime;//the countdown
}

else
{
gotoAndStop(7);//go to times up screen
}

clearInterval(timerInterval);
}

// set it so the timer counts down every second
var timerInterval:Number = setInterval(countDown, 1000);



this is the code on the pig movie clip, the pigs fall from the top:


Code:
onClipEvent(load) {
this._x = Math.random()*550; // 0 to 550
this._y = Math.random()*400; // 0 to 400
speed = Math.random()*3+4; // 3 to 6
drift = Math.random()*2-1; // -1 to 1
}

onClipEvent(enterFrame) {
this._y += speed;
this._x += drift;

// bring back to top
if (this._y > 400) this._y = 0;

// one side to another
if (this._x < 0) this._x = 550;
if (this._x > 550) this._x = 0;
}



onClipEvent (enterFrame)
{
if (_root.piggy_mc.hitTest(_root.bucket_mc))
{
this._parent.score++;
}
else
{

}
}


the code on the bucket that moves from left to right using the keyboard:


Code:
onClipEvent(load) {
x = this._x;
y = this._y;
speed = 5;
bucket_mc.swapDepths(100);
}

onClipEvent(enterFrame) {
if (Key.isDown(Key.LEFT)) {
x -= speed;
}
if (Key.isDown(Key.RIGHT)) {
x += speed;
}
this._x = x;
this._y = y;
}



so just to summarise our problem is that when only the original pig touches the bucket it keeps adding score to the bucket. we only want 1 point to be added to the score.

would anyone be able to help. i can attach the .fla file if required. thanks

Game Tutorial: Adding An If Score>5000?
note: i have flash mx 2004

Hey guys,
I followed your tutorial at here but am having problems, lol. I modified the game so that you whack the enemies with a sludge hammer instead of a laser and stuff (took me awhile to change it lol) but i'm stuck now....I know it seems so basic but i'm a newbie .

I'm trying to make it so that when the score hits a certian limit (ie: 5000) then for it to go to another scene (lets just say frame 5)

i got:

if (score>5000){
gotoAndPlay (5);
}

i put it in the control layer after the "score=0;" part. I tried so many derivitives with "no errors" lol, but it still doesn't work.

It can be found
here if any of you are interested. It's for a school project btw lol.

If anyone can tell me why it doesn't work i'll be grateful.

Thanks,
David.

Problem With Adding Points To Total Score
I have created a simple slot machine type game and each time you press the spin button you lose 1 coin. Got that no problem. I can't seem to figure out how to add points to total score when one of the dynamic text brings up a certain number.
I have three dynamic text fields that bring up random numbers when the spin button is pressed.
this is the script i have tried.
on (release) {
_root.total=_root.total-1;
if(_root.quote_txt==7){
_root.total=_root.total+10;
}
quote_txt is the instance name for my first text field, and total is my var for the score box.
I hope i've made sense of what i'm trying to do.
Please help, thanx.
kurth

Goto A New Scene After Certain Score In Flash Game
i have a third person game and after a score of 15, i would like it to go to a new frame. Does anyone know how to do this?

using Flash MX version 6.0
thx

Changing Scene On A Score Number Change
Hi, I'm currently making a little car game and I have a score board that I have incorporated. The name of the score item is just score, and I just want to know if there is a way to have flash change the scene once the player reaches a certain score?

Also, is there a way to edit the number of points you get for each enemy killed?

Thanks a bunch!

Adding A Dynamic Movieclip To A Dynamically Generated Movieclip
Code:
var _mc:MovieClip = new MovieClip();
var this['clip_new'] = new MovieClip();

for (var _i:int = 0; _i<10; _i++){
this['_clip'+_i+''] = new MovieClip();
_mc.addChild(this['_clip'+_i+'']);
}
addChild(_mc);

this['_clip0'].addChild(this['clip_new']); // error
how to add a dynamically generated moviclip as a child, to a dynamically generated parent movieclip .. pls help

Linking Movieclip Scene 1 To Scene 2
Hi everyone,
Just wondering how you link from a button in a movieclip in scene 1 to scene 2, this is probably really easy but i can't think right now.

Accessing A Movieclip On Scene 2 From Scene 1
I am trying to make a movieclip that is located on Scene 2, invisible from Scene 1.

code:
on (release) {
_root.movieclipname._visible = false;
}


Using "_root" doesn't work. How can I do this?

Thanks.

Adding Scene Issue
Hi !
I did flash project in one scene. I put preloader in frond of it (in new scene). Preloader works fine, but the code in next scene doesn't work at all!!!!

I didn't find any solution. I tried to paste all frames to new empty movie with two scenes. Script started to work, but gotoAndPlay commands dont work correctly.

Leos

Trouble With Adding A New Scene
Hi,

I have a main scene that begins with a animation. Now when i add a new scene to house a preloader and place it above the main scene and play the movie the preloader works fine but when it plays the next scene everything stops at frame 1. At 1st I thought it was my preloader but i tripled checked it and it was fine, I also just added a blank scene but i get the same problem. Im using flash 8. ne 1 ever get this problem?

thx

Problems Adding Just A Scene
hi guys,
i am getting in pain just adding a second scene to my flash 8 artwork.
...i have finished an intro and now the movie should jump to a second scene using gotoandplay("scene2", 1).
as soon as i add the second new scene from the scene inspector and play the movie, i get a movie that stops playing to the first (i think it's so) frame of first scene....well at the end ...as soon as i add a scene, the movie stops. no code added or removed!!!it's strange!!!
please helppppp
thank
adro

Adding A Link To Scene
Hi,

I am a total beginner in Flash and wanted to know, how to add a link that opens in a new window to a scene?
I found out that on AS2 it was done in a manner similar to:

ActionScript Code:
on (release)
{
getURL("http://www.google.com",_new)
}
or something like that.
Right now I got to this:

ActionScript Code:
Scene.addEventListener(MouseEvent.CLICK,goTo);
function goTo(e:MouseEvent) {
    var request:URLRequest = new URLRequest("http://www.google.com/");
    navigateToURL(request);
}
But I get an error 1061

Basically I need to add a link to another web page on my banner.

Help please?!

Setting Variable Score = Score + 1 Justs Adds Another Digit With 1
I am trying to work on how to add 1 each time to a text. I used the variable name score and a button has this command :
(on pressing the button) score = score + 1

It changes the text of score but each time you click it, it adds a new digit. this is the example of the first four times.

0 01 011 0111

Can anyone help me? My goal is to make it become

0 1 2 3 and so on.

Thank you

Adding A Scene Distorts Images
This seems very strange to me, but why would adding a scene to the movie lower the quality of the images I am using. I have images that look fine, but if I just add a scene to the movie the quality goes way down.

Thanks for the help,
Todd

Adding All Instances In A Scene To An Array
I want to instruct actionScript to look at my scene, go though each item on it (e.g. all of the check boxes and radio buttons) and add each of these items that have got an instance name into an array.

I can't think of a simple solution to this. Can anyone help please?

[F8] Adding Text Field In Scene 2
I have a two scene movie

In the second scene i have

Code:
createTextField("word_txt", 2000, 100, 100, 300, 100);
word_txt.multiline = true;
word_txt.wordWrap = true;
word_txt.border=true;

var my_fmt:TextFormat = new TextFormat();
my_fmt.color = 0xFF0000;
my_fmt.underline = true;
word_txt.text = "This is my first test field object text.";
word_txt.setTextFormat(my_fmt);


If I export the whole movie this doesn't work

If I export just the second scene it does work.

What do I need to alter to make it work if I export the whole scene

THanks in advance

Adding All Instances In A Scene To An Array
I want to instruct actionScript to look at my scene, go though each item on it (e.g. all of the check boxes and radio buttons) and add each of these items that have got an instance name into an array.

I can't think of a simple solution to this. Can anyone help please?

Blurry Graphics When Adding A Scene
Hello...i'm new at this forum and here's my first question:

When i add an extra scene to my movie (flash MX 2004) than all my graphics become blurry like a bad jpg. When i delete the scene again, the graphics are perfect.

Is this a bug in flash or am i doing something wrong? The graphics I imported are png or jpg.

I tried some changes with the jpg publishing quality, but that didn't work.

So..anyone with the solution?

Thnx in advance.

Adding 2 Sound Fx To A Scene But It Interupts The First Loop
Hi, i am working through one of the tutorials in swish and i have come accross a problem. IN THE TUTORIAL "THIS IS MY MESSAGE" i have added the vector graphics and the initial sound. However i wanted to added a sound effect when the first picture loaded in. When i did this my first sound loop cuts of then startes again when the sound fx is meant to cut in. So i look at sound/actions panel. I loop 88amp3 15 times and then at my first jpeg i loop a sound fx once. But when i play the whole scene my sound fx cuts in through the whole thing. When i go back to the sound panel i find that the setting have changed and the soundfx wants to play 15 times now overiding my initial 88amp3 sound loop. Its just that in future i want to put key sounds along side pics loading in and what not, and im not sure how to co-ordinate this. Anyone know what im doing wrong? Im pretty sure im close but i cant find the solution. Any takers?
Regards,
Gibbo.

Images Look Crappy When Adding Preload-scene
I have an imagesequence that should be exported with the swf in highest quality. Works great on it self and all, no problem whatsoever, UNTIL....

I added a preloader in a scene

Now when I export, the images look all crappy! Almost bitmap-like. I swear I've checked the properties of all images and the export-settings and all that.

Can someone help me with this problem?
Much appreciated,

Mediamonkey

Adding Scene Makes Images Fuzzy
I have a flash movie (flash 5) with imported PNGs for buttons. When I add a new scene (either by duplicating or adding new), the quality of these images plummets, even though I have the publish settings set to 100% jpg quality. As soon as I delete the new scene(s), the quality is restored. Obviously I can't publish a movie with poor quality images (it's like they've been enlarged and then over-sharpened in paintshop pro or similar, except they haven't). Does anyone know if/how I can remedy this? TIA

Help Adding Moviclips/Btns To My Papervision Scene
Please help. I'm new to papervision and AS3. I'm trying to spin a cube with materials and interact with buttons on the cube. I was able to assemble this:

http://www.methodengine.com/clients/...vidboxspin.swf

It shows my cube with my materials. I placed buttons over the box that spin it. I would like those buttons to actually appear and spin on the cube itself.

Can anyone out there point me in the right direction. I was able to add movieClips on the stage, but no in the front cube material.

Here is my code to make this happen:


ActionScript Code:
package {

    import flash.display.*;
    import flash.filters.*;
    import flash.events.*;

    // Import Papervision3D
    import org.papervision3d.events.InteractiveScene3DEvent;
    import org.papervision3d.scenes.*;
    import org.papervision3d.cameras.Camera3D;
    import org.papervision3d.objects.DisplayObject3D;
    import org.papervision3d.materials.*;
    import org.papervision3d.utils.virtualmouse.VirtualMouse;
    import org.papervision3d.utils.virtualmouse.IVirtualMouseEvent;
    import org.papervision3d.utils.*;
    import org.papervision3d.objects.*;

    import flash.text.TextField;
    import flash.utils.*;

    public class Main extends MovieClip {
        public var mc :MovieClip;

        // ___________________________________________________________________ 3D vars
        var container:Sprite;
//    var scene:Scene3D;
        var scene :InteractiveScene3D;
        var camera:Camera3D;
        var ism:InteractiveSceneManager;
        var plane:Plane;
        var time:Number;
        var tweening:Boolean = false;
        var myVidfront:Boolean = true;
       
        var mouse:Mouse3D;
        var vMouse:VirtualMouse;
        var material:InteractiveMovieMaterial;
        public var myVidContainer:MovieClip;

        private var frontMaterial:BitmapFileMaterial = new BitmapFileMaterial("images/player2_back.png");
        private var backMaterial:InteractiveMovieAssetMaterial = new InteractiveMovieAssetMaterial("flv", true, true);

        private var targetrotationY:Number = 0;

        var p:Cube = new Cube(new MaterialsList( {
          front: frontMaterial,
          back: backMaterial,
          left: new ColorMaterial( 0x000000),
          right: new ColorMaterial( 0x000000),
          top: new ColorMaterial( 0x000000),
          bottom: new ColorMaterial( 0x000000)
          } ), 800, 100, 500, 1, 1, 1);

        public function Main() {
            init();
            time = getTimer();
        }
        public function init():void {

            stage.scaleMode = "noScale";

            // add a spin btn
            var spin180_btn:PlayVid= new PlayVid();
            spin180_btn.x = 500;
            spin180_btn.y = 25;
            addChild(spin180_btn);
           
            // add another spin btn
            var spin360_btn:PlayVid= new PlayVid();
            spin360_btn.x = 400;
            spin360_btn.y = 25;
            addChild(spin360_btn);

            init3D();

            addEventListener( Event.ENTER_FRAME, loop );
            spin180_btn.addEventListener(MouseEvent.CLICK, spin180);
            spin360_btn.addEventListener(MouseEvent.CLICK, spin360);

        }
       
        // ___________________________________________________________________ Init3D
        public function init3D():void {

            // Create container sprite and center it in the stage
            container = new Sprite();
            addChild( container );
            container.name = "mainCont";
            container.x = 270;
            container.y = 200;
           
            // Create scene
            scene = new InteractiveScene3D( container );
            ism = scene.interactiveSceneManager;
           
            scene.addChild(p);
            p.rotationX = 0;
            p.rotationZ = 0;
            p.rotationY = 0;
            p.x = stage.stageWidth / 4;
            p.y = -100;
           
            var moreVids_btn:MoreVids = new MoreVids();
            moreVids_btn.x = 480;
            moreVids_btn.y = -130;
           
//      scene.container.addChildAt(moreVids_btn,1);
            moreVids_btn.addEventListener(MouseEvent.CLICK, spin360);
           

            // Create camera
            camera = new Camera3D();
            camera.zoom = 10;
            camera.sort = true; 

        }
       
        private function spin180(event:Event):void {
           
            tweening = true;
            trace(p);
            if(myVidfront){
                myVidfront = false;
                targetrotationY = 180;
            }else{
                myVidfront = true;
                targetrotationY = 0;
            }
        }
       
        private function spin360(event:Event):void {
            tweening = true;
            if(myVidfront){
                myVidfront = false;
                targetrotationY = 360;
            }else{
                myVidfront = true;
                targetrotationY = 0;
            }

        }
       
        // ___________________________________________________________________ Loop

        function loop(event:Event):void {

            if (tweening) {
                if (p.rotationY <targetrotationY) {
                    p.rotationY += Math.sqrt(targetrotationY-p.rotationY);
                    p.rotationY = Math.round(p.rotationY);
                } else if (p.rotationY> targetrotationY) {
                    p.rotationY -= Math.sqrt(p.rotationY-targetrotationY);
                    p.rotationY = Math.round(p.rotationY);
                }
            }
            scene.renderCamera( this.camera );

        }

    }
}

Adding Live Video To A Scene As A Texture?
Does anyone know if it is possible to add live video (streaming) as a texture in a Flash scene using AS3? If so, what software would I require to do this?

Adding New Frames Before Game Scene [mucking Up]
Got a game, asteroids, and it works fine, but when i move the frames along 1 so that i can add an into screen, with high scores and a play button, it throws off all my remove movieClips.

if anyone know as to why, would be great help.

Adding A Movieclip Inside Another Movieclip
i have a movieclip on the stage called spectrum. i want to create another movieclip inside spectrum, and then draw on that movieclip.


Code:
var spectrumShape:MovieClip = new MovieClip();
spectrum.addChild(spectrumShape);
spectrumShape.x = 0;
spectrumShape.y = 0;
spectrumShape.width = spectrum.width / spectrum.scaleX;
spectrumShape.height = spectrum.height / spectrum.scaleY;
spectrumShape.graphics.lineStyle(10, 0xFF0000);
spectrumShape.graphics.drawCircle(10, 10, 40);
when i test this, i see no circle inside the spectrum movieclip, or anywhere else. what am i doing incorrectly?

i have tried using a shape, and a sprite instead of a movieclip, and the results are the same.

Save Score And Put In Array To Pull Up All Score Later
Can you help please. I am new to this.
I have a list of people who answer 3 questions on 5 different topics. I can total their scores on the topic individually.
How do I total the first topic and show them and save their answers and go to the next topic and show their answers and next and so on and then get all the questions they answered for each of the 5 topics and their final score?

with thanks

Adding FPS To Movieclip?
hi all,

Ive created a movie clip in Flash which needs to be a faster FPS to the FPS of the actual scene, im not sure how to go about adding actionscript to the movieclip, does anyone have any suggestions?

CHeers guys,

JB

Adding 2 Functions To A Movieclip
Hi, I'm making a puzzle with flash and have hit a wall. I'm new to flash and even newer to actionscript so please, bear with me. haha.
I need to be able to rotate and drag the puzzle pieces.
This is what I tried....

on(keyPress <"Space">)
{
instanceName.rotate = instancName. rotate + 45;
}

on(press)
{
starDrag("instanceName, true");
}
on(release)
{


stopDrag();
}

If anyone can tell me what I'm doing wrong I'd appreciate it, thanks!!!

[F8] Adding Properties To A MovieClip
I have a for loop that assigns code to my buttons& add a an id property. For reasons outside my understanding I can not get the propterty to be add, but it adds the onRelease function but not the id . Here is my code


Code:

function btnEnabler(){
suspendData = 6
//add code to buttons
for(var i = 1; i <= (suspendData+1); i++){
trace("enabling chapters "+ i)
_root["ch"+i+"_btn"].id = i;
trace(["ch"+i+"_btn"].id);
_root["ch"+i+"_btn"].onRelease = function(){
gotoAndStop("lesson");
_global.currCourse = this.id;
trace(this.id);
}
}
//color completed lessons
for(var i = 1; i <= suspendData; i++){
trace("coloring completed chapter "+i);
var colorTrans:ColorTransform = new ColorTransform();
var trans:Transform = new Transform(_root["ch"+i+"_btn"].compStat_mc);
trans.colorTransform = colorTrans;
colorTrans.rgb = 0x00FF00;
trans.colorTransform = colorTrans;
}
};

in the output window i am returned

Code:

enabling chapters 1
undefined
enabling chapters 2
undefined
enabling chapters 3
undefined
enabling chapters 4
undefined
enabling chapters 5
undefined
enabling chapters 6
undefined
enabling chapters 7
undefined
coloring completed chapter 1
coloring completed chapter 2
coloring completed chapter 3
coloring completed chapter 4
coloring completed chapter 5
coloring completed chapter 6

Adding Movieclip To The Stage...
this is complete torture.

why is something which seems so easy SO difficult?

i've just made my first swf with sprites which you can throw around and they bounce off each other and are effected by gravity and drag (not the easiest thing or probably the smartest thing to start out at when teaching yourself as3) but can i get a simple movieclip to be place on the stage from the library?

can i heck.

i've created a private var menuBox1; (the name of the movieclip)

in the "private function init():void {" of my document class i've got the following:
code: menuBox1 = new menuBox1();
this.addChild(menuBox1);
menuBox1.x = 100;
menuBox1.y = 100;

the class name in the linkage panel of the movieclip is menuBox1, but this script keeps coming back with the following error:

TypeError: Error #1007: Instantiation attempted on a non-constructor.
at Inquizard/::init()
at Inquizard$iinit()

now i'll put my neck out from what i've read and say the problem is probably something to do with the fact i've got my movieclip and variable both called "menuBox1" but no real idea what to do now.

can some please save this mess as right now i have real fears for the safety of my monitor...

Adding Friction To Movieclip
I am currently trying to add friction a movieclip, called ground, so that when you let go of the UP key the movieclip slows down gradually.

i have written this code so far

var xVel:Number = 0;
var xAcc = -0.25;
var friction:Number = 0.9;

stage.addEventListener(KeyboardEvent.KEY_DOWN, acceleration);

function acceleration(evt:KeyboardEvent):void{
if(evt.keyCode == Keyboard.UP){
ground.x += xVel;
xVel += xAcc;
}
}

stage.addEventListener(KeyboardEvent.KEY_UP, deceleration);

function deceleration(evt:KeyboardEvent):void{
if(evt.keyCode == Keyboard.UP){
ground.x = xVel *= friction;
}
}

The problem is im not sure how to add friction to the current velocity. This just returns the movieclip to its original starting position. Can anyone help?

Adding Movieclip To Stage
I'm having problems getting a movieclip to appear on stage. Here's what I'm doing:

function RenderTiles ():Void
{
var CurTileName:String = "";
var CurTileNum:Number = 0;

for (var yt:Number = 0; yt < TILES_PER_WORLD_SECTION_Y; yt++)
{
for (var xt:Number = 0; xt < TILES_PER_WORLD_SECTION_X; xt++)
{
TILES_ARRAY[xt][yt].TileGraphic = this.createEmptyMovieClip( CurTileName, 10);
TILES_ARRAY[xt][yt].TileGraphic.createEmptyMovieClip ( "TileGraphicContainer", 10);

var TileGraphicLoader:MovieClipLoader = new MovieClipLoader();
TileGraphicLoader.loadClip(grass.bmp, TILES_ARRAY[xt][yt].TileGraphic.TileGraphicContainer);

TILES_ARRAY[xt][yt].TileGraphic

CurTileName = "" + CurTileNum;

trace (CurTileName);

CurTileNum++;
}
}
}

The TILES_ARRAY elements have been set to my Tile class which atm only contains var TileGraphic:MovieClip;

Adding Components To A Movieclip. How?
I am trying to get my head around MovieClips, UIObject and components and have got completely confused. Hopefully someone here can explain where I'm going wrong.

First what I am trying to do is really simple. I want to add a button dynamically to a MovieClip. I want to do it in pure ActionScript (ie I'm using the FlashDevelop IDE and have no .fla file).

So I started by looking at the MovieClip class. This has no "add a component" method. So I looked at the UIObject class. This does have a method for attaching a component. Great. But now I'm stumped. I do not have an instance of a UIObject; I have an instance of MovieClip. According to the documentation, UIObject extends MovieClip, but neither class seem to provide the means to create an instance of UIObject that wraps an existing MovieClip or to add an existing UIObject to a MovieClip. So I have two halves of the solution with no way of plugging them together.

I'm guessing I've missed something obvious here. What is it?

Adding A Link To A Movieclip
Hello, I am new to flash and inherited a template on a website that I am doing.

There is an instance of a Movie Clip that does a nice animation when hovered over and it stays glowing until no longer hovered on.

I want that instance of the Movie Clip to go to a website in a new window (_blank).

I've tried the on (click) and on (release) events for the actions of the Movie Clip, but doing so completely disables the functions of the Movie Clip so that the fancy animations don't work at all and neither does the link that I'm trying to do.

What should I be doing in order to achieve my desired effect of having an instance of a Movie Clip be a link to a website?

Thanks.

HtmlCode Img Src Id And Adding A MovieClip
I'm creating an application which has to display html page. However, this html page contains some images with adescription, which are surronded by text. I display html page by TextField.htmlText property. Unfortunately, it doesn't implement <div> tag.

I decided to put images and description into a MovieClip, and then put it into htmlText by <img> tag. It would work fine if those MovieClips size will be fixed. It looks similar to this code:

var tf:TextField = new TextField();
tf.htmlText = "<img src='MovieClipClass' id='MovieClipInstanceName'>";
var mc:MovieClipClass = tf.getImageReference("MovieClipInstanceName");
mc.setSomeParams(param);

The problem is that image's description length can vary, and when I use this method, thw text that surrounds images doesn't behave correct. Therefore I must set its parameters before adding to htmlText, so I must add an existing MovieClip instance to htmlText. Is there a way, to do this?

Adding Movieclip To Scrollpane
Hello,

I have a scrollpane on the main timeline. I've set the source to be mc_1. Within mc_1 is mc_2.

When I click mc_2, I want to display mc_3. If I put the gotoAndPlay("MC3_Label") in mc_2, the new movie clip is limited to the size of the scrollpane (cuts off extra).

So the best I could come up with is to gotoAndPlay to a label in mc_1. I've read through posts and thought the following would allow this, but I can't seem to get a label reference to the calling mc to work :(

Any help would be greatly appreciated!


FRAME 1 OF MC_1:
stop();

mc_2_instance.addEventListener(MouseEvent.CLICK,show_M3);
function show_M3(event:MouseEvent):void {
(this.parent as MovieClip).gotoAndPlay("M3_Label");
}


OUTPUT:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mc_2/show_M3()

Dynamically Adding MovieClip
I have a MovieClip in my library which is defined as a class that I have in an external actionscript file. That is, I have a MovieClip "mc_PortfolioElement" in my library and the linkage properties have "class: PortfolioElement". This PortfolioElement is an AS class that I have defined.

My publish settings have classes exported in Frame 2, but when I tell my MovieClip not to export in the 1st frame it does not show anything when I create a new object of its type. Then when I check "Export in first frame" it shows up when I create a new object of type PortfolioElement.

The only code that is relevant to this is:


Code:
var element = new PortfolioElement();
addChild(element);
How can I have the MovieClip export on a frame other than frame 1 and still display itself? Or it would even be great to know why it is NOT displaying itself when I tell it not to export in frame 1....do I need to manually load it in?

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