ActionScript 2.0 :: Unable To Use Prototype And For Loop?

Apr 13, 2004

I am trying to make a small hangman game using mostly AS. I have it set up so a word is randomly chosen from an array and then lines and text boxes are dynamically created depending on the number of letters in a given word. My problem is the AS to check to see if the letter from the input box matches a letter in the word and then output "lucky guess" or "guess again" depending on whether there is a match or not. Also, if the guess is wrong, the count variable increases by one (to keep track of the number of wrong guesses) and then goes to the corresponding frame to draw the hangman. I hope this makes sense. Here is the code I have for checking the letter from the input box to the letters in the word.

Code:
MovieClip.prototype.textFields = function(num) {
twid = 10;
//text width
thei = 20;

[code]....

submitis the movie clip button the user presses when a letter is typed into the input box.If you input the very first letter of the word then the code recognizes it as correct. Any other letter, whether part of the word or not, is given a "guess again". Count never seems to go above 2.

View 8 Replies


Similar Posts:


ActionScript 2.0 :: Get A Prototype Run From A Foreach Loop Depending On Instance Name

Apr 9, 2008

was trying to get a prototype run from a foreach loop depending on instance name... but i stripped the code. Why wont this work?

[Code]...

View 2 Replies

ActionScript 3.0 :: Unable To Get Scrolling Thumbnails To Loop Around

Oct 19, 2009

I made a Photo Gallery using flex builder 3. I am having a MAJOR MAJOR issue though. Currently I have thumbnails scrolling by, when clicked the fullsize image shows up in the canvas above. Unfortunately I cannot get the thumbnails to loop around. Here is my current movement code.

ActionScript Code:
public function defaultMovement(e:Event):void {
e.target.x += 1;
if (e.target.x > 338) {

[code]....

View 5 Replies

ActionScript 2.0 :: Unable To Get The "for Loop" Part ?

Jul 9, 2009

I am trying to loop through an array - nothing complicated, just a slideshow but I'm not getting the "for loop" part I think... This is what I have:

#include "utilities.as"
import mx.transitions.Tween;
import mx.transitions.easing.*;[code]......

View 8 Replies

Professional :: Warning Unable To Load SWC And Unable To Test Movie Afterwards (CS5.5 Also In CS5)

Oct 13, 2011

I work with Flash Pro allmost 11 hours per day and every while i get a error  which messes up everything. Approximetly i get this after about 2-3 hours withevery project.After i get this error there is no chance to test movies afterwards.I see a fast flash of the loader window but it dissapears so fast i cant even really see if it is loader.

View 1 Replies

ActionScript 2.0 :: Prototype...

Feb 27, 2004

Hi there,
can someone tell me what Prototype exactley is?
I guess it's something like css style sheets.
kind regards

View 3 Replies

Actionscript 3 :: How To Get MovieClip.prototype

Aug 12, 2010

In a ActionScript 2 code sample it uses some MovieClip.prototype's functions, as MovieClip.prototype.setModel;I'm trying to write this example using an ActionScrip 3 class, but the MoviewClip.prototype does not exists, where can I get it from? Does it exists in ActionScrip 3?

--update as you are asking, here goes, this code works just fine as an actionscript included on frame1, but I want to make a ActionScript 3 class with this same code:

//package
//{
// public class asteroids extends MovieClip
// {

[code].....

View 2 Replies

ActionScript 2.0 :: Prototype For TV Using D / Pad Navigation

Aug 25, 2011

I am using a software to load my swf in the TV and I can get basic functionality without problem. My issue is with creating a menu slider that is x and y sensitive without using the Xmouse or any mouse related property. This has to function within D-Pad Navigation and with a standard TV remote. I have had some success with using an invisible button (loaded with a script) to make the menu "move". This way doesn't allow much control.

View 6 Replies

ActionScript 2.0 :: MovieClip.prototype?

Sep 27, 2007

am finishing up the Friends of Ed Actionscript for Flash MX.At the end they show using MovieClip.prototype. Is this depreciated or not best practice? I was planning on moving onto FOE Object-Oriented ActionScript.

View 2 Replies

ActionScript 2.0 :: What Is A Usage Of Prototype

May 8, 2002

i don't understand the usage of prototype.

View 4 Replies

ActionScript 2.0 :: Prototype Does Not Work?

Dec 28, 2004

Why wont work this prototype ?I dont understand it.You can download the fla hereWhat do it need to do: When you roll-over a piece of the skyline it need to resize to that defined number.I putted the code in a for()-loop.

View 1 Replies

ActionScript 2.0 :: Prototype Align 5 Different Mc's / Swf's

Jan 9, 2005

ive made 5 diff codes to give the right positions on my mc's. but the code is all hanging on the mc's. Now i was thinking 2 put all code into 1 keyframe. So i think i need to write a prototype of it. It will be great if somebody out so i can understand more about how 2 write my own prototype for this. The file is just for study for me to play a bit with aligning mc's on stage. The code that is hanging on the clips are:

[Code]...

View 1 Replies

ActionScript 2.0 :: HitTesting A TextField.prototype?

Aug 23, 2009

I'm looking to run a trace that targets all TextFields on a mouse over, something like this:

PHP Code:
TextField.prototype.hitTest = MovieClip.prototype.hitTest;
onEnterFrame = function(){

[code].....

View 2 Replies

Professional :: Make An Educational App Prototype?

Apr 11, 2010

I'm trying to make an educational app prototype (I'm new to Flash, this is for a Masters in education) to help students learn IPA symbols (phonetics). I have successfully made a section where the students click on symbols to hear the corresponding audio and listen to explanations.
 
For the final part of the prototype, I have to create some kind of instructional game. My idea is to have 12 circles, each one playing an audio file of a vowel sound (this I know how to do). The students will have to click the circles to listen and then drag and drop them to the correct IPA symbol. Flash would then give feedback on correct/incorrect answers and a score. Maybe all of this is against the clock, needing a timer.
 
So, I need to learn drag and drop. What else to I need to learn so that one drop position is considered "correct", the others are considered "incorrect" and a score is given at the end? And maybe a timer?)

View 6 Replies

Actionscript 3 :: Add Setter In A Prototype In Flex

Jan 26, 2010

In Flex, you can add functions to the prototype of a Class; but how do you add a setter? For example, with A some (non-dynamic) class, you can do this:

var o:Object = new A();
A.prototype.myFunction = function():void{trace("foo");}
o.foo();

And that will call the foo function. But how could you add a setter, so that setting the property calls the setter (just like it would if you declared the setter in the "normal" way on the A class). So what I want is something like this:

// doesn't work!
A.prototype["set myProperty"] = mySetter;
o.myProperty = "test"; // should call mySetter

PS: Manipulating the prototype is an unusual thing to do in Flex, and not something I'd recommend in general. But for the sake of this question, just assume that there is a reason to dynamically add a setter.

View 2 Replies

Flash - Using SetInterval In MovieClip Prototype?

Dec 23, 2011

How can I use setInterval in movieClip.prototype? This code increase num value just one time...
MovieClip.prototype.testFunc = function(num) {
var num = isNaN(num) ? 0 : num;
trace(num);
clearInterval(this.slideDelay);
num++;
this.slideDelay = setInterval(this.testFunc, 4000,num);
};
var testMc = _root.createEmptyMovieClip("testMc", 1);
testMc.testFunc(0);

View 1 Replies

ActionScript 2.0 :: Combine PROTOTYPE With OnEnterFrame?

Mar 27, 2004

How to cimbine the prototype with onEnterFrame. I'd like to fade in some objects like this[code]...

View 1 Replies

ActionScript 2.0 :: Multiple Property Prototype?

Nov 8, 2004

I'm trying to make my first prototype, but I can't put it to work, I wanted to atribute a property to a variable, so I could call the prototype on to the movie clip, asking for any property, without having to change the prototype code.Is it possible?Here is my code so far:

MovieClip.prototype.multProp = function (proper,targetv, smooth) {
this.proper -= (this.proper-targetv)/smooth;
};[code]...

but it doesn't seem to work.

View 5 Replies

ActionScript 2.0 :: Implementing SetInterval In A Prototype?

Feb 3, 2005

I'm trying to write a prototype function that will use setInterval. The following script defines a simple movieclip prototype that traces the clip's x position when called. The function works fine when called explicitly ( _root.foo.trace_x(); ), but does not when called by a loop.There are three clips on the stage, their instance names are foo, man, and chu. I created an array so I could loop through and have each one run the trace_x function once.Here's the code:

Code:

clips = Array('foo', 'man', 'chu');
num_clips = clips.length;[code]....

but instead, the output is "undefined" over and over and over.An example .fla can be found at http:[url]....

View 1 Replies

ActionScript 2.0 :: Array Prototype Not Working?

Feb 10, 2005

I created a prototype function for the Array object. It's supposed to load and parse an XML file, then take all the values from the XML file and convert them to objects, which I then want to push to the array that called the function. However, I can't seem to get it to work.The function itself seems to work, but the push to the array does not. (code below)

Array.prototype.xmltoArrObj = function( path ) {
var xmlurl:String = "nav/" + path + ".xml";
var attr:String = "";

[code].....

View 1 Replies

ActionScript 2.0 :: Textfields To Use The Prototype At The Same Time

May 27, 2005

i've made a function prototype to make a "type-like" effect... but when i want two textfields to use the prototype at the same time, it ****s up! its like its only possible to use a prototype on one movieclip... not two movieclips at the same time...

View 4 Replies

ActionScript 2.0 :: Prototype Giving Error In It

Jan 4, 2006

Following prototype is running fine for action action script 1.0 but its giving error in action script 2.0.[code]...

View 2 Replies

ActionScript 2.0 :: Set A Prototype For HitTest Within A Loaded Mc?

Jun 6, 2006

I'm using the following code to set a prototype for hitTest within a loaded mc. It works great the first time, but I need to test to see if it's been called because it doesn't work if the code gets called on successive loads...

Code:
MovieClip.prototype.oldHitTest = MovieClip.prototype.hitTest;
MovieClip.prototype.hitTest = function(x, y, sf) {
var obj = {x:x, y:y};
this._parent._parent.localToGlobal(obj);
return this.oldHitTest(obj.x, obj.y, sf);
};

Is there a way to test to see if the prototype has been called before? I was setting a variable in the _parent movie initially, but I can't do that now so I need to test to see if the prototype has been called...

View 1 Replies

ActionScript 2.0 :: Get The Prototype To Update The Values Of A,b And C

May 21, 2007

I have 3 variables on the _root timeline.

var a = 50;
var b = 75;
var c = 100;

then i have a prototype which uses those

MovieClip.prototype.myName = function(a,b,c){
...
}

I then have 3 sliders which change the values or a,b and c.

My question is: How do I get the prototype to update the values of a,b and c as the sliders change the values of the variables?

View 1 Replies

ActionScript 2.0 :: Button Mouseover W/prototype?

Dec 2, 2003

I've got a menu with 3 menu items. Each item is a mc. There is a pointer mc that eases to the mc menu item that you mouseover. That was working fine...until I found out that I have to make the menu dumb enough for flash 5. As we know, you can't assign button events to mc's unless using flashplayer 6 or higher. So I tried to just drop some invisible buttons over my menu item mc's and assign the mouseover events to call the prototype in each invisible button. The prototype should then ease the pointer mc to the position of the menu item that I've moused over. Problem is that it restarts the playhead back to frame 1 each time I mouse over a button.

View 7 Replies

ActionScript 2.0 :: Prototype - Setting Mc's To Fade In Or Out

Nov 14, 2004

I'm looking for a prototype for setting mc's to fade in or out but I'm stuck with the code...here's what I have so far

[Code]...

View 14 Replies

ActionScript 2.0 :: Let A Button Call The Prototype?

Mar 5, 2004

Is there any way to let a button call the prototype?

View 1 Replies

ActionScript 2.0 :: OnEnterFrame From A Prototype Function?

Aug 30, 2004

The function is called on release of a movieclip. I'm making a drag a drop navigation and there are two content windows .. "h1" and "h3".

I don't think there's anything(much) wrong with my code itself, I'm just having trouble with calling anything within h_ins.onEnterFrame. Is there a fundamental issue that I'm not aware of? Below are all the details if you're interested.

[Code]....

View 1 Replies

ActionScript 2.0 :: Combining PROTOTYPE With OnEnterFrame?

Mar 27, 2004

how to cimbine the prototype with onEnterFrame. I'd like to fade in some objects like this:

[AS]
mc._alpha = 0
onEnterFrame = function () {
if (mc._alpha<101) {

[Code]....

or can it be done without onEnterframe with an interval or something like that?

View 1 Replies

ActionScript 2.0 :: Movieclip Prototype Not Responding?

Oct 20, 2004

I have an org chart that looks like this:

click to see

Anyway, there are 130 little boxes on that graphic, each one a movie clip. Because I want the same thing to happen on rollover of each movie clip I have put the following on my main timeline:

Code:
MovieClip.prototype.scale = function(w,h){
this.onEnterFrame = function(){
this._width = w-(w-this._width)/1.2

[Code]....

*edit* Another small problem - since the movie clips aren't all the same size the code MAKES them all the same size if you roll over them in quick succession. How can I prevent this? Is there a better way of capturing a particular movieclip's starting width and height, double it on rollover, and then returning to that on rollout?

View 14 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved