problems with actionscript 3.0

Hey im having some problems with my blackjack game. The problem is that the program will not pit the first function and it goes directly to the next function. Can someone help me find the error?

import flash.display.MovieClip;

Stop();

var cardArray:Array = new Array (kort1, kort2, kort3);
var knapp:MovieClip = new stortrivas;
addChild (knapp);
Knapp.Width = 100;
Knapp.Height = 50;
Knapp.x = 100;
Knapp.y = 200;
knapp.addEventListener (MouseEvent.CLICK, spelare);

function spelare(e:MouseEvent):void {}


z = 0;

for (var k: int = 0; k < 2; k ++) {}
var pickCard1 = cardArray [int (Math.random () * cardArray.length)];
var card1:MovieClip = new pickCard1();
addChild (card1);
card1.x = 250;
card1.y = 300;

If (k < 2) {}
for (var n: int = 0; n < 2; n ++) {}
card1.x = 250 + z;
card1.y = 300;
z = z + 50;

}

}
}
}
knapp.removeEventListener (MouseEvent.CLICK, spelare);
knapp.addEventListener (MouseEvent.CLICK, dealer);
function dealer(e:MouseEvent):void {}
z = 0;

for (var i: int = 0; i < 2; i ++) {}
var pickCard = cardArray [int (Math.random () * cardArray.length)];
var map: MovieClip = new pickCard();
addChild (card);
Card.x = 250;
Card.y = 100;

If (I < 2) {}
for (var j: int = 0; j < 2; j ++) {}
Card.x = 250 + z;
Card.y = 100;
z = z + 50;

}


}
}
}

There is no listener function that calls spelare().  immediately after the creation of a listener that calls spelare(), move you.

Tags: Adobe Animate

Similar Questions

  • Problem with ActionScript

    I had a problem with my code actionscript for a game I'm working on. I need to occur if the player is visible, unfortunately it fires if the player is visible or not, and turns the visible player when it is not supposed to be. Could someone please explain what I did wrong or help me fix my script?

    If (_root.playerleft._visible = true & & Key.isDown (83)) {}

    var bulletleft = _root.attachMovie ("BulletLeft", "BulletLeft" + _root.getNextHighestDepth (), _root.getNextHighestDepth ());

    bulletleft._y = FLF;

    bulletleft._x = _x-25;

    }

    use the double equal (==) to test for equality:

    {If (_root.playerleft._visible == true & {Key.isDown (83)})}

    var bulletleft = _root.attachMovie ("BulletLeft", "BulletLeft" + _root.getNextHighestDepth (), _root.getNextHighestDepth ());

    bulletleft._y = FLF;

    bulletleft._x = _x-25;

    }

    Alternatively, with a Boolean value, use:

    If (_root.playerleft._visible & Key.isDown (83)) {}

    var bulletleft = _root.attachMovie ("BulletLeft", "BulletLeft" + _root.getNextHighestDepth (), _root.getNextHighestDepth ());

    bulletleft._y = FLF;

    bulletleft._x = _x-25;

    }

  • Problem with actionscript 3 game movie

    I need two buttons in my film to play the parts of my calendar.  My actionscript looks like this:

    btnConnect.addEventListener (MouseEvent.CLICK, play_btnClickHandler);

    function play_btnClickHandler(ev:MouseEvent):void

    {

    this.gotoAndPlay (1);

    }

    btnBranded.addEventListener (MouseEvent.CLICK, play_btnClick);

    function play_btnClick(ev:MouseEvent):void

    {

    this.gotoAndPlay (149);

    }

    The first button works fine.  The second button will just frame 149 and stops.  What I am doing wrong?

    There is nothing wrong with the code that you show.  Look for something else, like a stop(); command in frame 149

  • Having a problem with Actionscript. Need help

    I'm trying to set up the first page of my project so that I have capture a person's name... and I can use it again later, the. I had discussed this in a previous thread with Ned Murphy:

    http://forums.adobe.com/message/3319540#3319540


    I half way have this working. For some reason when I type in the name, only parts of it appear when I retrieve it.

    Here's a look at my actionscript on the first page:

    stop();

    //Setting Up Name TextInput Field and Variable
    var userInput:String="";

    //Enter Button Setup
    enter_btn.addEventListener(MouseEvent.CLICK, copyText);

    function copyText(e:MouseEvent):void
         {
             userInput=name_ti.text;
               gotoAndPlay(2);
         }


    And here's the actionscript on the retrieval page

    //Textbox Greeting
    greeting_txt.text="Hello "+userInput+(!);


    Where am I going wrong?

    Have you tried to embed the fonts in your text entry box?  If you use Flash CS5 Pro is very important.

  • Problem with actionscript in Flash CS3 IDE window

    The actionscript window opens not upward for all frames on the timeline. When I press "F9" or try to access it via the context menu of the action of the window tab appears at the top in reduced form. No matter how many times I click above or the button larger, that the window does not open. I tried to reinstall Flash CS3, but it did not help.
    Any help with this issue is appreciated.
    Thank you!

    Found a solution for this atlast! Remove the Users/AppData folder for flash CS3 and things will be back to normal. Somewhere, it seems the screws of the IDE Flash and save settings for local users. These parameters of compensation restored my window of action!

  • I have a problem with Actionscript 3.0!

    I'm a beginner, so any help would be appreciated even if the solution is very simple.

    I got a preloader on AS 2.0 and it worked correctly with the following code:

    var program: Main = new hand (MovieClip (root));

    addChild (program);

    When I moved in AS 3.0, I get the following errors:

    Scene 1, Layer 'layer 53', frame 2, line 1, column 13.1046: type was not found or is not a constant of compilation: hand.
    Scene 1, Layer 'layer 53', frame 2, line 1, column 24. '1180: call to a method maybe not main set.

    Thanks in advance

    There is nothing on a preloader.

    usually a preloader as3 be in a separate fla/swf and fla might look like:

    var loader: Loader = new Loader();

    loader.contentLoaderInfo.addEventListener (ProgressEvent.PROGRESS, progressF);

    Loader.Load (new URLRequest ("your_project_swf"));

    function progressF(e:ProgressEvent):void {}

    Add a textfield on stage to display the progress of the load, for example your_tf

    your_tf. Text = Math.floor(100*e.bytesLoaded/e.bytesTotal) + "% Loaded";

    {if(e.bytesLoaded==e.bytesTotal&&e.bytesLoaded>0)}

    removeChild (your_tf);

    addChild (loader);

    }

    }

  • problems with rotation in actionscript

    What is supposed to happen:

    1. when the program starts, nothing is moving.
    2 press the right key, turns right, speed builds up as key is held.
    3 If the button is released, the speed slows down, can stop alignment, planned.
    4. If the press button to the left, turn left, speed builds up as button is held.
    5. If the button is released, the speed slows down, can stop alignment, planned.
    6. If both keys pressed at the same time, the speed, if the speed of 0, the object does not move.
    7. If turning right and the extent of slow, if you press the left button, slows down faster and ends by reverses.
    8. If turning left and being slow, if right key, slows down faster and ends by reverses.

    problems with the 6, 7 and 8.


    problem solved. I used a couple of dynamic text boxes feeding me information to have an idea of what what is actually happening and tinkered with it until I got this:
    I hope this is useful to someone else someday :)

  • Problem with the PrintJob background and default

    Hello, I have a problem with PrintJob - print in pdf format.

    I want to print bitmaps with transparency and vectors.

    I checked all the options and still have a gray background under the bitmaps and vectors. This is the background color from scene.

    It seems to me that flash is printing in bitmap mode no matter what I do.
    Anyone know how to print MovieClip/Bitmap without default background. I send to print bitmap/movieclip with transparency, but the output is always packed bitmap.

    var pj:PrintJob = new PrintJob();
    var sheets:MovieClip;// = new Sprite();
    var options:PrintJobOptions = new PrintJobOptions();
    options.printAsBitmap = false;
    var dodd:MovieClip = new MovieClip();
    stage.addChild(dodd);
    var pagesToPrint:uint = 0;
    if (pj.start()) {
        for (var i:int = 0; i < pages.length; i++)
        {
            sheets = new MovieClip();
            //sheets.graphics.beginFill(0xFF0000, 0);
            //sheets.graphics.beginBitmapFill(pages[i].getChildAt(0).bitmapData, null, false, true);
            /*sheets.graphics.lineStyle(0,0,0);
            sheets.graphics.drawRect(0, 0, pj.pageWidth, pj.pageHeight);
            sheets.graphics.endFill();*/
            sheets.addChild(pages[i]);
            dodd.addChild(sheets);
            try {
                pj.addPage(sheets, new Rectangle(0, 0, pj.pageWidth, pj.pageHeight) , options);
                pagesToPrint++;
            }
            catch(e:Error) {
                // do nothing
            }
        }
        if(pagesToPrint > 0) {
            pj.send();
        }
       
        while(dodd.numChildren>0){
            dodd.removeChildAt(0);
        }
        stage.removeChild(dodd);
        dodd = null;
       
    }
    
    

    using actionscript, create "pages" with a white background and content you want, and then print these new pages.

  • Loading of local swf files with actionscript on air for iOS

    I apologize if this seems like it has already been asked, but I'm not sure that having understood the answer, not on the Adobe site, or elsehwere.

    I am developing an app for iOS, targeting the last 3.9 SDK

    I have a main swf file that loads the local swf files. These local swf files have code actionscript in them. I use Flash Professional CS6.

    I publish the application successfully and everything's fine. When I start the app on the iPad, is the main swf and all is well. When I click on the button that loads the local SWF files, nothing happens. They are not loaded.

    It seems that this has been answered, but I'm losing my mind. I don't know what the problem is. I know that, in version 3.9 Air, it is now possible to load local SWF files are actionscript.

    Air for the Android version works perfectly with these local files loaded and unloaded like a charm.

    Any help would be greatly appreciated

    from the air, 3.6, you can load swf with actionscript and that run actionscript.  before 3.6 air that was not allowed (without additional work).

    but your charger must provide a loadercontext object that uses the current applicationdomain:

    var lc:LoaderContext = new LoaderContext(false,ApplicationDomain.currentDomain,null);

    yourloader. Load (yourexternalswf.swf, LC);

  • Problem with the results of the quiz.

    Hey guys, I have a problem with a questionnaire that I need to do, I use this model: http://www.Permadi.com/Tutorial/flashMXQuiz/index.html

    But does not include what I need and it is to know how to put a message at the end of the game that tells you that you have won or lost depending on if you had at least two questions of law or right less than two.

    I ve looking and have not found not any code I could add to my ActionScript.

    I have also tried with variables like this:

    If (numofQuestionsAnsweredCorrectly > = 2) {gotoAndPlay (3)}

    on the other

    {gotoAndPlay (6)}

    .. and stuff like that. I'm sorry if it's completely false... I'm just starting to learn.

    I hope someone can help me with this.

    Thank you

    Thank you guys so much for answering this quickly! I got the answer correctly thanks in part to Ned Murphy for having said that my code is correct. I feel a bit stupid because while I wrote correctly here, which actually was a mistake, you see, I had a couple of frames containing the tag that win or lose, and instead of the chassis number that I had written their names as in {gotoAndPlay("win")} but I wrote from memory and didn't know I had just changed. I realized that before sinious replied, but I'll check your tutorial anyway.

    Thank you very much.

  • asynchronousExportFile problem with windows mounted volumes

    Hello

    I see a very strange problem with the functions asynchronousExportFile and doc.exportFile from Indesign. They work perfectly in most cases, but if the user is on a Mac, and has a Windows mounted volume, the function of asynchronousExportFile level Indesign appears to try to add "/ Volumes" the path to store the file, even if it doesn't have been ordered to use this path.

    Here is the code snippet in which I am referring to.


    var outFile: file = File.documentsDirectory;

    outFile = outFile.resolvePath ("MyTmpFilePath");

    outFile.createDirectory ();

    {if (outfile. Exists)}

    outFile = outFile.resolvePath (outFile.nativePath + File.separator + fileName);

    var task: BackgroundTask = doc.asynchronousExportFile(ExportFormat.PDF_TYPE,outFile,false);

    task.waitForTask ();

    }

    This is the error I get

    () CSAWLib.CSLogger CSHostObject.hostCall failed on asynchronousExportFile - 1952403524,.

    /Users/Jess/documents/MyTmpFilePath/1-1.PDF with msg: cannot find the file ' / Volumes/Users/jess/Documents/MyTmpFilePath/1-1.pdf '.

    As you can see /Users/jess/Documents/MyTmpFilePath/1-1.pdf is the correct path, I feed the function, but somewhere in the code adobe adds "/ Volumes ' since I was" / Volumes/users "as a mounted directory. It should be not to convert the path to the "/ Volumes/Users/jess/Documents/MyTmpFilePath/1-1.pdf". Is a path not existing since support for Windows is not user 'jess'.

    If I remove the windows volume everthing works again. As a test I have even disassembled all volumes and went into my directory of Volumes and created a directory named "/ Volumes/users/abc", which causes the problem to appear again immediately. We tried this on several machines, and the behavior is the same. I also tried to deceive the function using a different directory by using of "... /.. '. "/" etc. does not.

    I also noticed that by the time I get out the "/ users" part of the way, everything works fine. Unfortunately this isn't an option because many users have privileges to write files outside of their user sandbox.

    Please, I struggled with this problem for days now and searched all forums. Any light that someone might throw on this topic would be very useful.

    Thank you

    Use the ExtendScript instead of ActionScript.

  • Strange problem with removeChild()

    Problem

    I create a quiz with oriented object.

    I instantiate a MovieClip of a response and I put (by prog) on my scene. When the question MovieClip is Event.REMOVED_FROM_STAGE, it calls a function on my stage and the code below.

    The first time she spent here, everything works fine.

    If I do a gotoAndPlay ("beforeQuestion") (I put on stage MovieClip the answer when the MovieClip of the reshow issue), and I resuppress this show it on output panel.

    When I get on stage I'm only a this.addChild () and I do not have a new MyClip(); and I never lost my MovieClip instance.

    Code

    x: is a number of current response because I stock all of my answer on this table

    this [x] ._tReponse: include a new MyClip();

         this = [object Main1_1]

    var oneMovieClip = this ._tReponse [x]; Instance of an item already on scene

    trace (oneMovieClip)

    trace (oneMovieClip. ( parent)

    this. removeChild (oneMovieClip)

    Output panel

    [object L1_1R2_1]

    [object Main1_1]

    ArgumentError: Error #2025: the specified DisplayObject must be a child of the caller.

    at flash.display::DisplayObjectContainer/removeChild()

    Find all object on this.getChildAt (a number) are zero. How is that possible?

    I found out the reason why he acted so weird in my case.

    If you change the order of the instance with ActionScript (this.setChildIndex (clip, numero_index)) to a clip of instantiated of the timeline, he loose track of it, for a reason even if the clip.parent looks right and the clip is always appear on the scene.

  • Problems with the movement of the front and back layers

    Hey everybody!

    I am very new to Flash, very very new to actionscript and basically, I started programming in general 2 days ago, and I have a problem with the layers in a project. I tried learning through books, but especially thanks to youtube tutorials, but I'm stuck here.

    Here is the .swf file: http://dl.dropbox.com/u/14319641/Flashprojekte/Variuscard%20Headertest.swf

    And here is the original .fla file: http://dl.dropbox.com/u/14319641/Flashprojekte/Variuscard%20Headertest.fla

    Two problems:

    1. I want maps to fly BEHIND the Logo, but in front of the shadow - so that it seems that the logo is original and the rest (maps and shadow) is in the back. I have 3 layers (Logo, Action, shadow), but no matter how to move around it do not go to the back...

    2. I would like to have a second fountain Let's say right left... can I just copy and paste the code? Seems similar is not...

    Can someone help me on this one? Pleeeeez ?

    Mike

    To create an empty movieclip you just select Insert-> new symbol and select movieclip and click OK.  Simply exit the editing for this movieclip mode by selecting Edit-> Edit the Document.  You now have a new empty movieclip in your library.

    With the desired layer selected, drag an instance of the movieclip in the library in the upper left corner of the stage and then give it an instance name of "mc" in the properties panel.

    I have no CS5.5, so I don't know if what I described in selecting is changed in the new design.

  • Problem with the sound &amp; UILoader

    Hello!

    I have a menu with 4 buttons. Each button loads a different SWF file, but I have a problem with the background music that I put on each of these files. As I had to put the music as an audio file of the event, so when the user clicks a different file, the background music of the original file is reading. And I can't put music as a stream because I have the Actionscript code in place he stops just before it even starts!

    The only way I can think to get any is put actionscript in my main menu to control the sounds... I guess I'm asking if there is a code to do no matter what stop music playing when another button was clicked?

    You can stop all the sounds at any time by running:

    SoundMixer.stopAll ();

  • Problem with &lt; b &gt; htmlText tag!

    Hello

    I have a problem with htmlText in AS3. I create in the font library. Regular and a "BOLD" of NeoSans version and export for actionscript. The < b > tag works, but the problem is that when I do it on my project, the police is not sharp and ugly but if I do the same step by step as3 empty of police project looks just great. I don't know what makes a difference. Please help me.

    I post images. I tried to create the same box htmltext in a different place in my project and fonts there seems too perfect. Only in the movieclip that I want to put my htmlText police don't is not look like that should look like (not sharp and ugly like the screen). I have no idea why it looks like this, in this one movieclip.

    PS Sorry for the bad English.

    use css to do this:

    var css:StyleSheet = new StyleSheet();

    "BOLD" var: Object = new Object();
    Bold.Color = "#000000";
    bold.fontFamily = new Yourboldfontclass (.fontName);

    regular var: Object = new Object();
    Regular.Color = "#000000";
    regular.fontFamily = new Yourregularfontclass (.fontName);

    css.setStyle (".reg", regular);
    css.setStyle (".bold", "BOLD");

    var tf:TextField = new TextField();
    tf.embedFonts = true;
    tf.styleSheet = css;
    addChild (tf);
    tf.htmlText = "Ut accumsan urna lobortis, and ullamcorper diam dictum vitae." Nullam ultrices, massa sit amet tincidunt dignissim, feugiat sem odio, nec, quam restore augue commodo eros massa. Pellentesque elementum lectus enim accumsan blandit mi. In volutpat imperdiet tincidunt. Surpassing in purus sit amet tempus auctor lectus auctor magna varius. CRAs hendrerit metus, sit amet orci faucibus eget bibendum ultricies. Proin ut odio nisl. Etiam nisi justo, ornare in, ultrices a, auctor id nulla. Mauris dictum aliquet sapien, sed dapibus enim tempor eget. Aenean tincidunt viverra nulla sollicitudin tincidunt sodales AC Vivamus imperdiet leo in ultricies vehiculasapien dolor. Integer adipiscing fitness Hall. « ;

Maybe you are looking for

  • Problem with end of line in the text file.

    Using LabVIEW 2010 on W7 64 bit in the USA. I have an application in which I write in a text file.  I use the function "Write to a text file" to write the text and "Reading a text file" function to read again.  My problem is with the end of line char

  • Remove a wrong metatag of labels (specifically geotag) in my Windows Live Photo Gallery

    Original title: remove a labels wrong metatag I am interested to delete/remove my labels metatag (specifically geotag) in my Windows Live Photo Gallery. I will keep the correct Geotag label I created. Thanks in advance!

  • Driver Epson Stylus Color 740for Windows 7 64-bit

    Hello I am trying to install an old printer on my system. Epson gives me the procedure to manually install the printer by using Windows Update. Unfortunately, the printer in not known in Windwos updated the list. Anyone know how to get this driver? T

  • Complete hard drive memory ~ solution Possible?

    I've recently upgraded Vista Home Premium to Windows 7 Ultimate on my laptop HP DV6. HP Recovery Hard Drive (D) has always displayed full 11 GB & no backup possible. Local computer Disk Drive (C) displays 36 GB FREE OF 221 GB TO 250 GB STORAGE. Real

  • Windows error 8 Driver_IRQL_NOT_LESS_OR_EQUAL

    I am also having this problem with my Toshiba Satellite L840. Since I bought this last may 2013, Im having error Driver_IRQL_NOT_LESS_OR_EQUAL. My hard drive already crushed and sent to the service center. They replaced the hard drive but still Im ha