Incrementing counter on stage through the class

Hello everyone, I have a thread similar to this on the saving and loading of a meter. However, I can not get the counter increment when colliding with an object. When the collision with the object, it makes not visible so that you can not see more.

My meter that records and load looks like this:

var so: SharedObject = SharedObject.getLocal("myStuff","/");

var JumpCounter: int = 0;

If (SO. Data.JumpCounter)

{

JumpCounter = so.data.JumpCounter;

}

And when you jump:

JumpCounter ++;

so.data.JumpCounter = JumpCounter;

so. Flush();

It outputs here in a text box:

JumpBox.text = JumpCounter.toString ();

This set works very well, I just can't get it to increment when colliding with my MovieClip.

I have a class that looks like this attached to my MovieClip I want to increment which looks like this:

package {}

import flash.display. *;

import flash.events. *;

SerializableAttribute public class AddJumps extends MovieClip {}

build function

public void AddJumps (): void

{

addEventListener (Event.ENTER_FRAME, collision);

}

private void collision(e:Event):void {}

If (this.hitTestObject (MovieClip (root). (Player)) {}

MovieClip (root). JumpIcon.visible = false;

}

}

}

}

I'm not sure access to the or increment my counter to a category. I can't remember how to access the scene.

Thanks in advance!

It's the only part that you add to your class:

MovieClip (root) .incrementJumpCounterF ();

Tags: Adobe Animate

Similar Questions

  • How do they interact between the stage and the classes?

    Hello

    I asked this question before, and all I got is 'Go back to reading beginner books', so I hope that someone here is willing to actually answer my question rather than brushing because they were unwilling to help...
    And Yes, I have read books on the topic and been through tons of documentation and not found the answer to this. I have 1 ActionScript and JavaScript experience, so this whole thing shouldn't be this hard.

    I am using ActionScript 3 in Flash CS3.

    My problem is the following:

    I need to know how to send commands between the stuff on the stage and stuff which is defined in a class.
    I had this problem for centuries and kept trying to find ways around it since so far I couldn't find help for her.

    For example:
    When you use a document class, how can I get the number of the current frame of the stage?
    Or using a class of documents, how can I access any object (such as a MovieClip with instance name) who has been on the scene with the IDE?

    Currently, to be more precise, I'm doing something really simple:
    Make a button work on my scene, which is not always visible. With AS3, which is not as easy more than before.
    So what I have now, is to create the button in the document class, used addChild and set it to alpha = 0.

    Now, when the stage reached specific images (i.e. those with labels, and I got this part understood), it is supposed to make the button visible. Then I can add stuff and event listeners, and I can understand this part myself.

    I do not know how to access the number of stage of the document class setting, so I put it in a script of frame in frame 1, but now this script cannot access the button that is defined in the document class.

    It makes me bananas...

    Please, here, can someone someone explain to me how can I make this work?

    I've seen many diagrams of the list of display and the object hierarchy, but none of this, explains how to USE effectively all...

    Thank you in advance to anyone who is willing to spend the time to answer!

    Well, first of all, I must say that AS3 is fundamentally designed to be difficult on purpose, this interaction between the objects is intentionally very strict. For this reason, I always use AS2 to all my basic work of Flash. AS3 is just much more involved, much tighter, much less forgiving... it takes a lot of experience with it before it begins to make sense.

    Now, I think I might have a few answers to your questions:
    Any DisplayObject instance (this includes any class of Document, which must extend MovieClip or Sprite instances) you can access the scene using the "stage" property

    However, stadium is probably not exactly what you want, you want the main timeline, which is a child of the stage. To access the main timeline, you can use the 'root' of any DisplayObject property.

    However, unless you have the strict mode off, Flash will let you just say 'root.myMovieClip' because the root property is of type DisplayObject, that is not a dynamic class (which means that you cannot add properties to it) and it has not built in the "myMovieClip" property, so he thinks you did a mistake. You have to "climb" the root as a MovieClip property, which * is * dynamics so it will allow you to try anything on this subject of reference (like AS1/2 does with everything.)

    So what this means is it should work from the inside, document you class:

    .myMovieClip (root as MovieClip)
    or
    MovieClip (root) .myMovieClip

    Either successfully make reference to a MovieClip you set on the main stage in the IDE and named 'myMovieClip '.

    Rather than set the alpha to 0, try the visible parameter to false. I think that this will disable all interactive events, where simply setting alpha to 0 it would still be interactive.

    HTH

  • to access the pots through the class-path to the manifest of a shared library.

    I have a large number of pots that are used by the J2EE applications and stand-alone (client) applications.

    I like to keep only one copy pots on the drive (for example, in a myLibraries/lib directory).

    Is there a way I can create a shared library with the Class-Path entry in a manifest that points to the jar files in the myLibraries/lib directory? (If Yes, which? the ear of shared library manifest, the manifest of a pot of "module" in the ear of shared library or the manifest of a pot within the APP-INF/lib?)

    Otherwise, it seems that I have to include copies of these pots in the EAR of my shared library application.

    Thanks in advance
    Mike

    Mike,

    I guess that it may be possible to refer to the pots where they are already using a manifest, but this isn't how I saw. If you look at weblogic.jar, it's META-INF/manfiest.mf uses references to other module pots. However, you're talking as if you want to do something more absolute path. Why not consider the following which is more standard...

    To use a pot as a shared library or optional package, study it:
    http://download.Oracle.com/docs/CD/E14571_01/Web.1111/e13706/libraries.htm#i1070930

    Basically, make sure that the jars you want to be a shared library have a manifest file which specifies the extension name, spec, and version impl.

    For example. Let's say you have myExtension.jar - inside there should be a META-INF/MANIFEST. File MF that looks like this:
    Name of the extension: myExtension
    Specification-Version: 2.0
    Implementation-Version: 9.0.0

    Deploy this jar in a WLS library.

    Second, depending on which classloader you want to access in the container, make a reference to the optional package. For example, in the EAR that you want to access this pot, change META-INF/MANIFEST the EAR. MF so that it looks like this:
    List of extensions: myExtension
    myExtension-Extension-name: myExtension
    myExtension-Specification-Version: 2.9
    myExtension-application-Version: 9.0.0

    You can also reference the style jar libraries in weblogic application. The EAR like this XML:

    ...

    myExtension

    ...

    Note that the library-ref above referring to a jar approach does not work for applications packaged as WAR files and editing weblogic.xml, you must use the obvious approach for the web module archive jar base shared libraries reference.

  • External ACL does not increment for traffic allowed through the site to site VPN

    Hi all, we have many site - to IPSEC VPNS that are sending traffic to us successfully - the largest part of this traffic is FTP or SFTP.

    There is not configuration of the firewall of the SAA sysopt. Access lists have been configured on the external interface of the ASA to allow these VPN for FTP SFTP connections & - however, all counters are 0 when I do a 'show access-list internet-in' for FTP or SFTP.

    There are general IP entries in list of FTP & SFTP natted access connected to the Internet addresses of these FTP servers and these are increment but then there are certain customers who use the internet to transfer files.

    I guess what I was asking is ASA outside increment for traffic access lists allowed by VPN? The access list entries are for THEIRINTERNALIP to OURINTERNALIP (according to crypto card)

    Just to add that these ACL is configured through groups of objects in the case that matters - also once again that they are correctly transfer files to us - only I don't get where they are allowed.

    Thanks in advance

    Mark

    VPN traffic is flowing properly and there is no ACL allowing UDP 500 or ESP?

    Can you post the output of "sh run all the sysopt"

    Federico.

  • Iterating through the classes 'Point '...

    Hello world

    I have a question very very simple to ask:
    The following lines are inside one of my methods:


    Focus() dim = new Point [5];

    for (int i = 0; i < 5; i ++) {}
    protected.x = (int) (Math.Random () * 100);
    Var [i] there = (int) (Math.Random () * 100);
    }


    and for some reason, I get a null pointer exception error!

    Any help... ?

    Edited by: 806602 the Οκτ 31 2010 03:57 μμ for some reason any Sun is not displayed correctly! It should have been (i) .x Sun and Sun (i) there

    Edited by: 806602 the Οκτ 31 2010 03:59 μμ

    806602 wrote:
    You start an array of 5 strings...

    .. .but they have not been instantiated yet...
    so I guess that the result would be null in both cases...?

    Exactly! It goes the same for your situation. Creating a table does not automatically create objects and insert them for you.

    PS how do you set the code tags?

    Type

     before and after your code.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    
  • How well the class prepare you for the exam?

    I'm looking at planning for the installation of VCP5 set up class (not the fast track one).  I have given the task up VMWare ESXi and run for my group.  I will do this on Cisco UCS.  Even if the Cisco class is supposed to help me get started on getting installed ESXi, I plan to pay on my own to go to VMware installation you configure class.  What concerns me, it is the class getting ready to review?  I got several Cisco certificates over the years and have found that classes don't really help you with what is perhaps reviews, as a writing group at Cisco exams and one other group wrote material for classes.

    I would like to hear from those who have gone through the classes for your printing.  I am watching 3 third-party sources for other material that would help me as well as establishing a "lab" server using vm workstation or fusion and ESXi running on this.

    Thank you

    Ron

    The class teaches you the product so it will obviously help, but the objectives of the training are only a partial match to review.

    You can compare the objectives of training compared to the objectives of the review by downloading the form of training and the examination plan.

    There is lots of useful information and links on my blog, including links to some practical examinations - click on the VCP5 tab.

    Regarding the labs, I would look at Autolab and build the ultimate vSphere lab.

    Here are the links for the above:

    Training - http://mylearn.vmware.com/mgrreg/courses.cfm?ui=www_edu&a=one&id_subject=37587

    Review - http://mylearn.vmware.com/mgrReg/plan.cfm?plan=12457&ui=www_cert

    Blog - http://vmwaretraining.blogspot.co.uk/

    Autolab - http://www.labguides.com/autolab/

    Build the ultimate vSphere Lab - http://boerlowie.wordpress.com/2011/11/30/building-the-ultimate-vsphere-lab-part-1-the-story/

  • Access the class from the loaded module

    I have this in the main application and I the public variable test in the module. The problem is that I don't know how to access it properly.

    public

    var fontsModule:IModuleInfo;

    public var FontsClass: Class;

    public

    function initApp(evt:FlexEvent):Sub

    {

    fontsModule = ModuleManager.getModule ("modules/fontsBG.swf");

    fontsModule.addEventListener (ModuleEvent.READY, fontsLoaded);

    () fontsModule.load

    new ApplicationDomain (ApplicationDomain.currentDomain), null , null , moduleFactory);

    }

    public function fontsLoaded(evt:ModuleEvent):Sub

    {

    FontsClass = fontsModule.factory.create)

    as Class;

              trace ()' HERE: "(+ FontsClass.test);". "

    }

    If I replace the class with the name of the 'FontsBG' class actions script in this example, everything would work, but the main swf file size goes from 100 to nearly 400 kbs when the fontsBG.swf file is 67 kbs. So I'm certainly not doing it right.

    So the question is: what is the correct way of loading the modules and using their properties and functions - through the class or interface and how it's done? Please set up a small code example so I can get the concept of base as well as the readers of this thread.

    Thank you!!!

    (3) again, you will need to use a shared interface or a common base class.

    Most people put the UI widgets in a module and they all extends UIComponent

    You can reference them as UIComponents.  If they need to access other

    Properties and methods, they define an interface.

    (1) my guess is that the button does not know what a module with embedded

    fonts loaded and don't refresh to use.  Normally, you would

    wrap styles in the module with the fonts, and then set styleonce

    the module is loaded.  In this case, you specify MyriadPro as the

    CSS font family and he would set via setStyle once the module is loaded.

  • How to target the movieclip on the stage of cutom class

    This is the code and the clips are target1_mc & target2_mc

    package {}
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    import flash.text.TextField;


    public class recipeMC extends MovieClip {}

    private var startX:Number;
    private var startY: Number;
    private var counter: Number = 0;


    public void recipeMC() {}
    this.mouseChildren = false;
    this.buttonMode = true;
    this.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    this.addEventListener (MouseEvent.MOUSE_UP, dropIt);
    }
    private void pickUp(event:MouseEvent):void {}
    this.startDrag (true);
    this.parent.addChild (this);
    this.x = startX;
    startY = this.y;

    }
    private void dropIt(event:MouseEvent):void {}
    this.stopDrag ();

    If (this.hitTestObject (target1_mc)
    || this.hitTestObject (target2_mc)) {}
    this.removeEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    this.removeEventListener (MouseEvent.MOUSE_UP, dropIt);
    this.buttonMode = false;
    This.x = myTarget.x;
    This.y = myTarget.y;
    counter ++;
    } else {}
    reply_txt. Text = "Try Again!";
    This.x = startX;
    This.y = startY;
    }

    }
    }
    }

    If target1_mc, for example, is on the main timeline (and this instance of the class is added to the display list), use:

    MovieClip (root) .target1_mc

  • What should I do to the stage of a class?

    I have a class that puts objects on stage with addChild (obj), it allows to position myself objects using pixels (say obj.x = 10; obj.y = 50 ;) very well but if)

    I have try this: obj.x = stage.stageWidth / 2;  I get a message that I can not access a property or method of a null object reference

    The stage property is available for objects that are currently on the display list. Your best bet is probably to pass a reference of the scene to the class when you instantiate.

  • How to remove an event on the stage listener from outside the class defined it

    Hello

    I use a component in my app, but it turns out, it slows down my app down big time b/c it does not remove an eventListener on stage for the movement of the mouse. Is there a way I can remove this listening port? I can't in category b/c it is a component and it has no sort of kill function to call.

    Any help would be great.

    Thank you

    You must always have access to the class that contains the listener to remove this listener if this class is precompiled or not.

  • Reg: Url of the Image that passes through CSS class

    Hello
    How can I pass the image through Css class?
    Thanks in advance.

    Hello

    I don't know if this can be done in the css file as well.

    I assume that you use the bean of support for setting the skin (just read your old thread). If so, you can add two images on the page and set the visible property according to the skin. Something like

    
     
    

    If I select the second CSS file so the logo will change according to the style class defined in the CSS file first.

    As far as I KNOW, the logo of the company would be static;).

    Arun-

  • I just tried to download Vista SP1 on my count, he went through all the motions and now my computer is nothing but a black screen.

    Very angry about this, until I tried to install this pack, my computer was working perfectly. Now, it seems that my entire system has been destroyed, and when I try to contact Microsoft, it seems that I have to pay $72 Australian, just to get him to talk to me. Seems hardly fair, that their pack which crashed my system. Someone has an idea of what he must do to either restore my system (without the use of disks to restart), or is anyone know how I can contact Microsoft without paying (since this is not a problem on my side). Any suggestion would be appreciated.  Regarding what happened, he went through the entire process of installation of the service pack, but when he stopped for the last time, the computer starts with a very simple beeps and then nothing, no white screen, no warning, no prompt, nothing.

    Will need you the DVD

    How to uninstall Windows Vista service packs as a troubleshooting step
    http://support.Microsoft.com/kb/948537

    FYI learn how to install Windows Vista Service Pack 1 (SP1)
    http://windowshelp.Microsoft.com/Windows/en-us/help/133c8953-c9cd-4FA5-8883-03e91bb6f2021033.mspx

    TaurArian [MVP] 2005-2010 - Update Services

  • Try to add my volume icon to the taskbar. Has passed through the stages but unable to check the box for the icon?

    I noticed that when I turned on my laptop that the volume was very fort! So, when I went to my silent icon it is when I noticed that he was not there with my battery power icon button. Then I wen through the steps to add them both back to my taskbar. Which were: click Start and then right click on the properties button, and then on the Notification area. Under system icons it won't let me check the volume and the power icon icon!

    Help

    Hello Annette,.

    From your description, I understand that you are unable to add the volume icon and the power icon to the taskbar.

    Run the fixit suggested in the following link.
    System icons do not appear in the notification area in Windows Vista or Windows 7, you must restart the computer

    http://support.Microsoft.com/kb/945011/en-us

    Registry WARNING: This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, see this link:

    http://Windows.Microsoft.com/en-us/Windows-Vista/back-up-the-registry

    If you have additional questions, or if this problem persists, come in and we will be happy to help you.

  • paper HP deskjet f2480 &amp; fires of black ink. Has passed through the stages. new cartridge. Continues to blink.

    I have a printer hp deskjet 2480 all in one. The paper and ink lights flash. I went through the trouble shooter and replace the cartridge. Continues to blink. All the answers as to why and what next? Error code 095E76ZB.

    Thank you all for you answering my question on my printer HP Deskjet f2480 problem. Sorry for the late update, but I take care of an elderly parent and have been busy with appointments.

    The problem of the printer turns out be a problem of cartridge after all. We took it to a repair shop. The person told us that this printer is particular about the cartridges. He plays well with non HP cartridges or refills. We had been filling at Costco with no problems for a while. Costco has verified the refill cartridge and it checked OK. Go figure. After trying a few new HP cartridges, we finally got one to work.

  • To access the display object on the stage of another class

    I Googled that nothing helps, I only found how to manipulate the scene itself and not a display on that object and I'm noob enough to not be able to figure it out from there. :/

    I have a clip on the main timeline with the instance name displayName. I created a button that should change this framework displayName will to (in order to... makes you guess? display the name of the button.) Awesome. )

    So, I'm trying to write the code in a reusable manner and have everything related to a class called GeoPuzzle buttons. Inside the GeoPuzzle I instantiate a touch event and run code. However, the function should be able to change displayName in the main part of the timeline and, of course, the compiler says displayName does not exist because I'm in a class and I don't mean the scene.

    Here's the code simplified in the class:

    package com.freerangeeggheads.puzzleography {}
    import flash.display.MovieClip;
    import flash.events.TouchEvent;

    SerializableAttribute public class extends MovieClip {} GeoPuzzle
    declaring variables

    public void setInitial (abbrev:String, fullName:String, isLocked:Boolean): void {}
    Set the parameters
    this.addEventListener (TouchEvent.TOUCH_BEGIN, geoTouchBeginHandler);
    }

    public void GeoPuzzle (): void {}
    }

    public void geoTouchBeginHandler (e:TouchEvent): void {}
    e.target.addEventListener (TouchEvent.TOUCH_END, geoTouchEndHandler);
    other methods
    nameDisplay.gotoAndStop (e.target.abbrev);
    }

    public void geoTouchEndHandler (e:TouchEvent): void {}
    other methods
    nameDisplay.gotoAndStop ("USA");
    }
    }
    }

    The lines in bold are my problem. Now this code does not actually as it is the case if you find an error in it, Yes, I have no idea what the problem is, but he DID run forward and these lines always gave me wrong so I'll try to help out on multiple fronts.

    How can I say displayName to change its current image within the display object class?

    Thank you!

    any display list object can refer to any display list object, but this is not necessarily good OOP.

    in any case, for your class reference displayName:

    . DisplayName MovieClip (this.parent)

Maybe you are looking for