About current frame property

Hello I am trying to make as3 take action when a certain frame is reached. As far as I understand I need to use current frame property. But it does not work for some reason. It is about as. file so my object is referred to as "this". 
if (this.hitTestObject(_root.mcBall)){
    _root.ballYSpeed *= -1
    if(!hit){      
        hit = true
        this.gotoAndStop(2)
    } else {      
        this.gotoAndStop(3)
  removeEventListener(Event.ENTER_FRAME, enterFrameEvents);
_root.brickAmt --;
I have animation playing inside frame 3 at the end of which goes to (parent) frame 4. How can I tell it if the current frame is 4 to do  _root.brickAmt --;  At this point? Is there another command I can use?
Thanks!

Yes I am sorry.... tried that 1 week ago..... Its the most logical solution and it would not work......Can I put "if" statement after "if" "else??...... This is the whole code. and the _root.brickAmt--; at the end is not responding....If I don't have   if (this.currentFrame == 4)... It works. May I ask why?
public class Sinote extends MovieClip {
  private var _root:MovieClip;
  public function Sinote(){
  addEventListener(Event.ADDED, beginClass);
  addEventListener(Event.ENTER_FRAME, enterFrameEvents);
  private function beginClass(event:Event):void{
  _root = MovieClip(root);
  _root.brickAmt ++;
  private function enterFrameEvents(event:Event):void{
  if (this.hitTestObject(_root.mcBall)){ 
              _root.ballYSpeed *= -1 
             if (this.currentFrame == 1){   
        this.gotoAndStop(2)
        } else {                     
        this.gotoAndStop(3)
  if (this.currentFrame == 4){
  removeEventListener(Event.ENTER_FRAME, enterFrameEvents);
  _root.brickAmt --;

Similar Messages

  • QuickTime Applescript Dictionary property for luminance on current frame

    Anyone know if there is a way to reference the luminance of the current frame via the Applescript dictionary?
    Or know of a scope application that applescript can use to get the luminance?

    I can't figure out how to capture the current frame of the flash movie sprite.
    You were almost there. Try either of these:
    put sprite("flash").currentFrame
    -- or
    put sprite("flash").frame

  • Display current frame in applet.

    I am writing a Java applet that creates a media player. It plays a movie and I want to get the current frame. I have the code for this:
    FramePositioningControl fpc = ( FramePositioningControl)  player.getControl("javax.media.control.FramePositioningControl");
    int currentFrame = fpc.mapTimeToFrame(player.getMediaTime());I have created a text field and this is displayed on one of the panels of media player.
    My problem is that I can only get the frame number for the first frame to appear in the text field and it doesn't change for each frame.
    I have my code in the public synchronized void controllerUpdate(ControllerEvent evt) method as follows:
    tf3.setText(""+currentFrame);Any ideas as to how I can get each frame number to appear?
    I hope I have made myself clear enough.
    Thanks in advance,
    Wallace

    I have my code in the public synchronized void
    controllerUpdate(ControllerEvent evt) method as
    follows:controllerUpdate() is not called every time a new frame is encountered. It is called, for example, when the Processor or Player becomes "Realized", or is started or stopped.
    From your Processor or Player, you need to obtain the TrackControl that is an instance of VideoFormat.
    (note p is a Processor created and in the "Configured" state at this point in the code)
              TrackControl tc[] = null;
              // Obtain the track controls.
              tc = p.getTrackControls();
              // Search for the track control for the video track.
              TrackControl videoTrack = null;
              for( int i = 0; i < tc.length; i++ )
                   if( tc[ i ].getFormat() instanceof VideoFormat )
                        videoTrack = tc[ i ];
                        break;
              }You then need to create a custom Codec (or chain of Codecs) which you will insert into the data flow using p.setCodecChain( Codec[] codecs ) Override the process() method in your custom Codec to update your counter, as it will be called once for each frame.
    For example:
    public class PreAccessCodec implements Codec
         public final int process( Buffer in, Buffer out )
    //UPDATE YOUR COUNTER HERE!
             // Swap the data between the input & output.
             Object data = in.getData();
             in.setData(out.getData());
             out.setData(data);
             // Copy the input attributes to the output
             out.setFormat(in.getFormat());
             out.setLength(in.getLength());
             out.setOffset(in.getOffset());
             return BUFFER_PROCESSED_OK;
    }You will have to do a little searching through java.sun.com to find out about implementing a custom Codec, but I guarantee this will help you out... it is fundamental to the success of my application. I wish you luck!

  • Uix frameset - how to get the current frame name?

    I have a frameset with 3 different frames in it. a top, center and bottom.
    There is a menu in the top frame that changes the contents of the center or bottom frame.
    How can I get the value of the frame name for the current frame into a bound value like a httpsession or page?
    for example if I change the center frame to "listadmin.uix" how can I load a bound value with the frames new source?
    Is there a way to pass javascript to a boundvalue? I could get the frames new properties from javascript

    In Jdev 9.0.3 you could do something like this:<frameBorderLayout>
    <start>
       <frame name="sideFrame">
        <boundAttribute name="source">
         <ctrl:pageURL name="sideFramePage">
          <ctrl:properties>
           <ctrl:property key="currentFrame"
                          value="sideFrame"/>
          </
         </
        </
       </
    </
    </then in startFramePage.uix you can access the current frame name by doing:<styledText data:text="currentFrame@ctrl:page"/>

  • Saving current frame in flash

    Hi everyone,
    Any help would be really appreciated. I'm a web developer,
    normally in php, and I'm making a flash based app that allows
    people to upload a photo of themself, print, email and save it. I
    can do print with no issues, but saving files is really being a
    sticking point. I want them to be able to save the current frame as
    a jpeg or bmp.
    Does anyone know anything about this? If it's even possible?
    Thanks a lot in advance
    Paul

    Thanks.
    Essentially, what I'm trying to do is record which object the user clicks, where he drops it (within the grid), how long it takes, etc. Currently, I'm just using the "trace" command alongwith the flash debugger to write it to a text file. However, using the debugger is not really conducive in the long run. Ideally, I'd just like to write the data to a text file in the form of name variable pairs that could be read by statistical packages like Excel or SPSS.
    I've created the interactive grid but am stuck on the data part. I don't really need the application to re-read the data once the user finishes, so using "shared objects" may not be ideal.
    Any suggestions?

  • Reading the current frame of an Event Structure

    Is there a way to read the current frame (or state?) of an Event Structure?
    Richard

    johnsold wrote:
    Normally a program would not stay in an event case for long enough for the phrase "current frame" to have much meaning.  What are you trying to do?
    Lynn
    Like tst assumed, it's for edit time use. Some events take a few seconds, and the progress would be nice to watch on the FP like you'd typically do with a state machine, and with dynamic events (as opposed to just user events), it would be nice to see where the structure is going.
    I have tried something with scripting as shown, but it's not much help. There's no property "Current Frame" or similar. Visible Frame (as shown) doesn't do it.
    Richard

  • After Effects Unable to Allocate Enough Memory to Render Current Frame/ MeshWarp problem.

    Hello,
    I am currently working with 17 layers in AE- CC 2014.1.1 (13.1.1)  Most of the layers have multiple effects, including the "Mesh Warp,"- which happened to have been freezing my computer constantly.  I finally had to change computers... First, I was unable to render these layers, because there is not enough memory space. So I went back to editing. After adding a couple of video layers, I went to play back, and got the above message:  "After Effects Unable to Allocate Enough Memory to Render Current Frame"
    I changed my "cache" folder to my external hard drive. I also upped the cache space from 23MB to 50MB. But I am still getting this error.
    In terms of the Mesh warp: Once i brought the effect to the video file, and tried to move the grid, I got the rainbow spinny ball. It went away after a while. As soon as I clicked on ANYTHING- i got the wheel again. This continued until I "Forced Quit." I don't know what thats about...
    This is the info for the Composition Settings/ computer I am working on. i am trying to give as much information as possible. This is for my Senior Thesis! Can anyone please help me ASAP?
    Best,
    Julia

    What are these layers you're working with? What size? What format? What Codec? What color space?
    What happens if you turn on Render Multiple Frames Simultaneously (reserving at least one core for other programs)?
    Julia_SpecialEffects wrote:
    I also upped the cache space from 23MB to 50MB. But I am still getting this error.
    I assume you mean GB, not MB...
    What happens if you save to version 12 and try to work on it there? (If you don't have an older version installed, try it: Creative Cloud Help | Install, update, or uninstall apps)
    Have you tried rebooting your machine recently? Do other programs/apps//software run normally?

  • Save current frame causes a crash

    every time i try to save a frame as a jpeg or png... fcpx just crashes and closes. i was able to do it prior to the most recent upgrade i did.

    i'm not in front of the machine right now...
    but basically, i've done it successfully before... it's only since the recent upgrade that i've been having issues.
    as soon as i hit "share... save current frame", final cut crashes... it doesn't even get to the point where it asks me what format or location i'd like to save it in...
    maybe a problem with the part of the program that generates the image?
    i thought about deleting fcpx and reloading it, but i'm afraid i'll lose my project and timelines...

  • When playing a home video DVD using DVD Player I tried to use the "Controls, Use current frame as jacket picture" facility to create a printable image but with no success. Can anybody point me in the right direction?

    When playing a home video DVD (created on my Panasonic DVD/Hard Disc recorder)  using the Mac DVD Player, I tried to use the "Controls, Use current frame as jacket picture" facility to create a printable image but with no success. I assume that any file created by this action would be stored somewhere in a common format but cannot find any such file. Can anybody point me in the right direction?

    Hi Sinious,
    Interesting to know about 10.8 and Flash. I'll hold off upgrading until they work together. Currently using 10.6.8 at home and same on the Universtity's computers.
    Haven't verified on Windows but shall do later in the week if I can get access to a Windows machine.
    Both the Flash player and the Projector come up not full screen, and if I leave it that way then things work OK as long as I don't make the video full screen (using the full screen button on the skin).
    However if I make the swf or projector full-screen (by using CMD-F or the menu option) then when I click on the menu item to take me to the page with the video on it, instead of a page with a smallish video and back button I get a black screen with no obvious controls. If I then press Escape I get my normal screen back and I am in the page that should have the video but there is not video and the back button does not work. So something wierd is going on here.
    If I make a file without any videos with a similar navigation structure everyting works ok except that when I go full screen I lose the finger cursor when I roll over my buttons (which is also wierd).

  • How search text in current frame of external swf?

    Hello Everyone
    I am loading an external swf using loader.
    How do search and highlight the text in the current frame only?
    Is there a frame class which I could use?
    Thanks

    This is not likely to be possible in the general case, depending on what you mean by "searching text"
    For instance, a Word doc might have the text "Hello, world!" when viewed in Word, but that doesn't mean that the sequence of characters 'H', 'e', 'l', 'l', 'o', etc., exists in the file. There might be one letter, then some binary data indicating that the next letter is some other font or color, then one more letter, then more binary data, etc.
    Conversely, there could be textual metadata in a "binary" file that a person reading the file in the appropriate viewer would never see. Unless you know the details of the format you're reading, you won't be able to distinguish that from "real text".
    And what do you mean "strings" is not efficient? Have you tried it? Does it do what you want? Did you measure and determine that it does not meet your well-defined performance requirements? It's unlikely you'll be able to write code that does the same thing as "strings" but more "efficiently."
    The first step is to put more realistic boundaries on your requirements and define them more precisely. "Extract text from any binary file," is not a valid, meaningful, or reasonable requirement.
    EDIT: I may have misunderstood your requirements. I thought you wanted to "extract all text" from binary files. If that's not what you meant, and you're looking more to replicate grep, then follow Joachim's advice.
    Edited by: jverd on Mar 29, 2010 1:33 PM

  • How to get the footage's current frame number in expression?

    There are 2 layers.One is text layer,one is sequence layer.
    Footage has begun from the 20th frame.
    Therefore, the number of composition's current frame number and footage's frame number has shifted.
    I want to show footage's frame number in text layer . not composition's frame number.
    How to get the footage's current frame number in expression?
    Tatsuya

    >Footage has begun from the 20th frame.
    Do you mean that the footage layer has been trimmed (so that the start of the footage lines up with the start of the comp, but the first 19 frames are not visible), or moved to the left (so that frame 20 lines up with the comp's frame 0), or that the sequence actually begins with the 20th frame (at frame 0 of the comp), or something else?
    Are the frame rates of the comp and the footage the same?
    Dan

  • Will only give print option of "current frame" for a six page PDF document opened from link in Safari.

    I'm new to Mac having just moved from a PC.  The TD Ameritrade site provides statements as PDF documents which are opened by clicking on a link.  The document is displayed in a pop-up window and there is no problem viewing all pages by scrolling.  But there is no PDF toolbar and Safari will only allow me the option of printing the "current frame", not the entire document or several pages.  What am I missing?  Does the Mac not actually bring it up as a PDF? 

    Hold down the OPTION key and click on the link. That will cause the document to download to wherever you set DLs to go. Then, open it in Preview and print everything.
    Since you're a newcomer to the Mac, see these:
    Switching from Windows to Mac OS X,
    Basic Tutorials on using a Mac,
    Mac 101: Mac Essentials,
    Mac OS X keyboard shortcuts,
    Anatomy of a Mac,
    MacTips,
    Switching to Mac Superguide, and
    Switching to the Mac: The Missing Manual,
    Snow Leopard Edition.&
    Additionally, *Texas Mac Man* recommends:
    Quick Assist,
    Welcome to the Switch To A Mac Guides,
    Take Control E-books, and
    A guide for switching to a Mac.

  • External Video: Show Current Frame

    This isn't hugely important but since starting with FCP I have wanted to be able to show external video whenever I'm parked on a frame - i.e. not moving video. I often want "All Frames" off because it can choke on the full resolution/framerate I'm trying to assess.
    For the longest time I thought External Video / Show Current Frame was supposed to do this but just wasn't working. It eventually occurred to me that you have to shift-f12 every time you want the output updated.
    Is there a way to tell FCP to "show current frame" whenever I pause playback or step through frames?

    Another strategy is to turn off 'mirror on desktop'. That reduces the processor overhead significantly which is very useful on low power machines yet you get all your images sent to the external monitor.
    The check box can be found in: Menu Bar>Final Cut Pro>Audio/Video Settings> A/V Devices>
    Scrubbing in the Canvas works and the current frame will show up in Canvas when you stop messing around. Canvas is only bypassed when you play the timeline.
    good luck.
    x

  • Hold on current frame lingo

    So basically I have my main menu which takes you onto the loading screen and finally the game.
    How do I stop my movie from skipping to the loading screen?  I know I can use the 'hold on current frame' from the behaviours but I want to use the lingo.  Any help appreciated. 

    I currently have it so that the movie holds at the main menu but im using the hold on current frame behaviour from the behaviour library.  I want to replace these with lingo.  

  • CP4 - View Current Frame of Captured Animation?

    Hello all, I'm a new CP4 user, so bear with me on this question.
    When editing, I was wondering how I can view the current frame under the playhead for a captured animation WITHOUT scrubbing?
    I have a bunch of captions to align to elements in the captured animation, but in edit mode I can only see the first frame of the animation, and I have to scrub (drag playhead) in the timeline to see what is visible in the animation at that time frame in which I am working.
    Thanks!
    Rob

    Hi there
    If you want to see the animation in a paused state, scrub the timeline using the mouse until you see the part where you wish to add a caption. Then, without releasing the mouse, press Alt + Tab to switch to a full screened application. You may now release the mouse. Press Alt+Tab to return to Captivate and you should still see the image as if you were still scrubbing. You could then screen capture it or use some other method to aid in correctly placing the caption or element you are adding.
    I'd like to add that this is but one of several reasons recording using Full Motion is generally a bad idea.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

Maybe you are looking for