Actionscript code in a swf dont run when impoterd in flex

Hi,
I have an actionscrip flex project.
I embed a movieclip from a swf like this:
[Embed(source="../../content/testmenu.swf",
symbol="MenuOne")]
public static var MenuOne:Class;
The movieclip has a frame with this code:
dispatchEvent( new Event( "InCompleted", true ) );
stop();
running in flash everything works properly but in flex the
movieclip dont stop play and i dont get the event
Any help on this?
Thanks

Go to Project -> Properties -> Flex Library Build Path -> Classes (Tab)
Uncheck any of the actionscript files that are not actually classes, but rather an external import into a class (your MXML).
Also, FYI, it is common practice to use lowercase for actionscript files that are includes, and not actual classes. Camel case file names should be reserved for class files..

Similar Messages

  • Complete code for loading swf file in actionscript 3

    i have a swf
    file which i want to load into a fla file and export as a new swf file. I understand this part but my actionscript 3.0 code that i put on frame one of the timeline does not work. I have tried every version i have seen online including in adobe's actionscript 3 classroom in a book.... and other books..... i want the swf to run immediately so i dont think i need any event listeners since i am not clicking a button or anything like that... just running the swf at start. any help wuld be appreciated... sent two day on this already... i can do it in actionscript 2 but have not figured it our in actionscript 3......... why does eeryone seem to do this slightly different too?   a complete code would be nice since obvously i am stupid........
    thanks

    Show the code you put in frame 1.  I don't think you can do what you say you intend to though.  As far as I know you cannot create a new filein the way you explained you intend to.  If you load the file dynamically as a separate swf, then you will always need to.

  • Use loadSWF load my stage3D game swf and show In AIR , This swf may crash when running

    Problem Description:
    use loadSWF load my stage3D game swf and show , This swf may crash when running
    Steps to Reproduce:
    run my Upload Project . Fill in the login box, any account and password . Because of network problems, you may need to wait a long time to show up login box
    Actual Result:
    this swf crash when running
    Expected Result:
    this swf do not crash when running
    Any Workarounds: 
    Test Configuration
    My Hardware and Environment details:
    1.this url's swf load files in worker
    2.this url's swf use SDK is Flex 4.6.0(bulid23201)
    3.this url's swf is Flex Project
    Upload Project Url:
    http://fight.fuhuodao.com/fight/testUrl/!FightAirShell.zip

    The loading of SWFs from AIR has a different Security model than that of the WebPlayer.  There is a workaround to loading plugins in AIR: If you use a static plugin this should work for you.  To do this: Link in the plugin at compile time, and pass the PluginInfoResource to the loadPlugin() method.

  • Will app store approve an app to load external swf containing actionscript code in it?

    Will app store approve an app to load external swf containing actionscript code in it?

    Hi...It is not in the application bundle...it will be hosted on a server and from there it will be loaded in the application. I had created one sample application where it is loading a swf which is hosted on different server. This swf contained some actionscript code on its timeline. This app was working on ipad. I just wanted to know whether App Store will approve this.

  • Which buttons dont work when you run windows xp

    the keyboard for a mac and a pc are kinda different. are there ne buttons that dont work when you run xp with bootcamp?

    Only one I can think of (if you're using the latest version of Boot Camp) is the "delete" key won't act as "delete" (such as in ctrl + alt + delete) under Windows. Other than that, every other key should function correctly. (The Apple/CMD key will work as the "Windows key." And the "option" key will be "alt."

  • Add code behind functionality that run when the user view the SP 2013 content pages

    I need to add code behind functionality that run when the user view the SP 2013 content pages, What is the best approach to do that?
    is it add Delegate Control to master page?
    is it add code behind to master page?
    is there an event reviver for that?
    Your answer will be highly appreciated

    Hi,
    According to me, for code behind stuff
    Create master page(using module etc..), have the required placeholders in it.
    Then, create a page that inherit from this master page, now you can use that placeholder in you page.
    Lastly, place web parts in that placeholder. So, code behind will come with that master page .
    Hope it helps.
    Thanks
    -Rahul

  • Buttons and ActionScript Code

    Hi everyone just signed up to this forum today, really need help, would appreciate your help.
    Basically I have created 5 buttons on one single layer. I am now trying to link each button to a website, but to no success as of yet.
    I realised that maybe in order to make it easier for myself I need to put each button in its own layer and insert the following actionscript code I've inserted for one of my buttons:
    stop()
    home_btn.addEventListener(MouseEvent.CLICK, mouseClick);
    function mouseClick(event:MouseEvent):void
    var request = new URLRequest("http://www.sign-technologies.net/");
    navigateToURL(request,"_blank");
    This code links my first button "home_btn" to my site, which is still underconstruction. When I run it in flash it works, but when I click the button in the actual web browser it will not go to the webpage, so I'm stuck.
    Another question: For convience sake is there a way I can have all the buttons in one layer, but insert code that can seperate one button from the other? Anyone have that code?

    You can place all of your buttons in one layer and all of your code preferably in another layer.  What you will need to do is have differently named functions for each button.  You can not name them all "mouseClick"... I'll suggest you name the function in relation to the button, as in....
    home_btn.addEventListener(MouseEvent.CLICK, homeClick);
    function homeClick(event:MouseEvent):void
         var request = new URLRequest("http://www.sign-technologies.net/");
         navigateToURL(request,"_blank");
    As far as the file not working when testing in a browser, it should.  There is nothing wrong with the code.
    There are other ways of coding where you can have the same function shared by all the buttons, but that might be a better lesson for another day.

  • Hiding Actionscript code

    Hello,
    Apologies in advance if this question has been asked many
    times before - I know virtually nothing about Flash or
    Actionscript.
    We're investigating the possiblity of distributing Flash
    projectors with our application. We'd like to copy-protect the
    projectors and we're looking using Actionscript to write some
    copy-protection code.
    Before we even start this, we need to know whether it's
    possible to hide our Actionscript code - it looks like there are
    tools available to enable someone to take a peak at our code (e.g.
    Action Script
    Viewer).
    Is it possible to hide ActionScript code? Would we need to
    use an obfuscator?
    Many thanks.

    there are two related, but different issues here. one is
    hiding/encrypting/obscurring actionscript in a swf and the other is
    stopping someone that has a legit copy of your software from
    distributing it without your approval.
    first, you can obscure your code and make it difficult for a
    novice to unobscure without using a secure external file.
    actionscript obsfucator is an example of one such (trivial)
    obscuring program.
    but it's very easy to "crack" (and that term is used very
    loosely because the schemes are all trivial to unravel and probaby
    don't deserve the term). and it's easy to automate the unobscuring
    of such swf-obscurring schemes using a jsfl file.
    in the end, it's quicker and easier to unobscure actionscript
    that an author has run through a program like actionscript
    obsfucator than it was for the actionscript's author to obscure.
    and that's a pretty bad obscuring scheme. but it's still good
    enough to block the majority of would-be code lifters.
    now to answer your question, flash can load several file
    types (like txt files, xml files, aso files) that may be relevent
    in this discussion and several file types that i don't think are
    relevent (jpg, mp3 and swf) files. it can also prompt the execution
    of some programs.
    however, files on a computer, no matter the file-type, are
    not secured from an authorized user of that computer. a local file
    can hide nothing that it contains from unrestricted users of that
    system. though again, it may be difficult for a novice to inspect
    some file types (like aso files).
    further, this external file has to be loaded (or executed)
    using actionscript in flash and this part of the flash actionscript
    would have to be "unencrypted/not obscured" in order to prompt the
    loading/excecution of the external file. so, anyone could "see"
    what file is being used to load the "key". and therefore it's
    location and that fact that it is "the key" cannot be hidden. and
    that eliminates your security.
    the user simply copies that "key" file along with your
    projector file and can distribute that pair to anyone they like.
    the user need not even unobscure or decrypt the remainder of your
    actionscript and need understand nothing about your (possibly)
    sophisticated encryption/obscurring scheme.
    so, for your purposes that won't work. for someone that only
    wants to protect their actionscript from being inspected it is
    possible to encrypt the actionscript and prevent that from being
    decrypted by all but the most sophisticated of decryption
    specialists, IF they have, at least, one secure file (that would
    contain the "key(s)").

  • How to pause stage/swf with audio when a new tab is opened/ out of focus in browser

    I have created a container in Flash Professional CS5 for my project’s CBT.  I’ve been able to script many of the features we require using AS3, but there are a couple of things I’m still trying to work out.
    I would like the swf presently playing in one tab to pause and go silent when another swf is opened in a new tab (the sound is inside this externally loaded swf which is loaded inside a movie clip from buttons nested a movie clip down).  I’ve tried :
    var originalFrameRate:uint = stage.frameRate;
    var standbyFrameRate:uint = 0;
    addEventListener(Event.ACTIVATE, onActivate);
    addEventListener(Event.DEACTIVATE, onDeactivate);
    function onActivate(e:Event):void
           stage.frameRate = originalFrameRate;
           trace("in focus");
    function onDeactivate(e:Event):void
           stage.frameRate = standbyFrameRate;
           SoundMixer.stopAll();
           trace("out of focus");
    And
          I’ve looked into the HTML tag “has Priority”
    and coded buttons to:
    function fl_ClickToGoToWebPage(event:MouseEvent):void
           navigateToURL(new URLRequest("http://www.ansaldo-sts.com/AnsaldoSTS/EN/index.sdo"), "_blank");
           MovieClip(this.stage).stop();
    With variations of:
    MovieClip(this.parent.parent)stop();
    MovieClip(this.parent.parent.parent.parent)stop(); because the button is 3 movie clips deep.
    MovieClip(this.root)stop();      MovieClip(root)stop();MovieClip(this.currentTarget.root)stop();
    Could someone please provide me with the code?
    This function is present when I publish the CBT with Captivate, so obviously there must be code available. You can set the Captivate button to open url in new window and pause movie.
    Is there something I can add to the html file that is similar to the “has Priority” for mobile devices or is there javascript that can be added to the flash itself?

    You would send a command to Flash from JavaScript when window.onblur event occurs.

  • How to tell embedded jinitator applet is still running when window closed

    Hello, we are trying to accomplish the same thing that is mentioned in this post from Metalink. I've searched for a solution and hope someone here can help. Instead of restating the issue I think David Wilson does a good job of explaining what is needed. Can anyone please suggest a possible solution?
    From: David Wilton 07-Oct-05 01:08
    Subject: How to tell embedded jinitator applet is still running when window closed
    How to tell embedded jinitator applet is still running when window closed
    Hi,
    We run an oracle 10g forms application through 9iAS over an intranet. All users are running windows 2000 professional.
    We run separate frame = true but I would like to switch to separate frame = false
    With separate frame = true if the user clicks the outer windows "X" close button (forms mdi window) the user is prompted to save changes before the application ends.
    BUT
    when using separate frame = false
    If the user clicks the upper window "X" button (no longer form mdi window but regular browser window) the window and application is abruptly closed.
    I'm interested in using a onbeforeunload function to confirm if the user wants to close the window. This would be placed in the basejini.htm file. This could always ask if the user wants to exit or not. If they click OK then the window closes but if they click "Cancel" you are returned to the forms application exactly where you left. something like event.returnvalue="do you really want to exit?";
    However if the user exited using the normal exit form method then the applet is already closed before the onbeforeunoad event fires and there is nothing to go back to and I want the window to close automatically. This is accomplished using close.html file in post forms trigger.
    So what I want and what I think many may also want is the check if the embedded applet is still running and if so prompt the user to return to the application or continue to close. Of course If the applet is no longer running then just close because there is no reason confirm closing anymore.
    Does anyone have a html/JavaScript solution that can be placed in the jinitiator.htm file? or similar?
    Thank you
    David
    [email protected]
    From: Andrew Lenton 07-Oct-05 08:58
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    I don't know if this is exactly what you are after but you can add the following to the top of your basejini.htm file and it should prompt the user before exiting the IE window.
    <BODY %HTMLbodyAttrs%>
    %HTMLbeforeForm%
    <SCRIPT>
    <!--
    window.onbeforeunload = unloadApplet;
    function unloadApplet(){
    message = "Warning! Please exit the Java Applet prior to
    exiting the browser"
    return message;
    //-->
    </SCRIPT>
    From: Oracle, mohammed pasha 07-Oct-05 09:55
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    David,
    Well I could not understand your complete requirement.
    Refer to Note.201481.1 How to Close the Browser Window When Closing Forms And How to Simulate SeparateFrame By Javascript
    Note.115905.1 How to Close Browser Window When Closing Webforms Applet
    Kind Regards,
    Anwar
    From: David Wilton 07-Oct-05 14:37
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    Thank you for your reply and yes you did not understand my question fully.
    Sorry if this is a long reply
    I am able to close the browser window using information in notes 115905.1 and 201481.1, this is not the issue. We implemented this several years ago. It is workable for both separate frame = true or false.
    It is most important to not allow the user to end their forms application by closing the windows browser, they must close using normal form exit commands.
    What I want is to have separate frame = false, the big drawback to this option is the user can exit the application and bypass all forms code by pressing the windows "X" close button. This is why we need the code as just provided by Andrew Lenton above in this thread.
    BUT Andrew's code will always prompt the user before closing the window and I do not want that. I want the user to be prompted only under scenario 2 listed below.
    Here's the 2 case scenario for exiting the application.
    1. If the user closes properly and uses exit form which fires all normal form triggers including post_form with it's call to close.html file.
    All uncommitted changes are saved or rollback and the users session is ended normally both on the database and in the application server.
    All browser windows will close, great all is good. And without Andrew's code the window will close but with Andrew's code the user will be prompted to close or not, if they select Cancel the window will remain but the applet has already ended so why prompt? ...This is what I want to avoid.
    2. In the forms app. if the user clicks the windows "X" close button with uncommitted changes. The browser just closes the changes are rollback without prompting the user to save. The users sessions are now lost and still running in the database and application server until they are timed out.
    If I use Andrew's code then the user will be prompted to continue to close or go back, if they click Cancel to go back then focus returns to the forms application and the user can continue to work. If the user clicks OK then the window closes and unfortunately their sessions are still lost until timed out.
    So what I desire is to add to Andrew's code to check if the embedded applet is still running and prompt the user to close or not accordingly.
    Something like:
    Basejini.htm like
    </HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    function maximizeWindow()
    window.moveTo(0,0);
    window.resizeTo(screen.availWidth,screen.availHeight);
    function confirm(){
    If(document.embeddedapplet.closed())
    Win.opener = self;
    win.close();
    Else if
    event.returnValue = "Closing Forms Application. OK to continue?";
    </SCRIPT>
    <BODY %HTMLbodyAttrs%, onload="maximizeWindow()", onbeforeunload="confirm()">
    %HTMLbeforeForm%
    I hope this explains my requirements.
    David
    From: Oracle, Evelene Raechel 10-Oct-05 06:45
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    Hi,
    Note.199928.1 How to Alert User on Closing Client's Browser Window in Webforms
    Regards,
    Rachel
    From: David Wilton 11-Oct-05 17:40
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    I'm sorry this is not helpful at all.
    Note 199928.1 is only an alert which does not stop the closing of the window and still displays as an alert if the user does close properly using exit form ... so why would you want to display the alert then?
    This is exaclty what I do not want and why I want to determine if the applet is still running before displaying any kind of message.
    David
    From: Oracle, Evelene Raechel 17-Oct-05 12:23
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    Closing thread.
    Thanks,

    Hello,
    I had the same issue last year - wanting to provide a warning on closing the browser, but only if the Forms session is still running. The approach I took is described below, see also the thread where I originally posted this at Closing brower window
    Hi there,I've had a similar requirement - or rather, the two conflicting requirements: to warn when the browser is being closed, but for the app to be able to close the browser without a warning being fired.
    To always provide a warning when someone (the user or the Forms app) tries to go to a different page (e.g. your close.htm), use Javascript like:
    function confirmExit(){
    if(appletRunning==true) {
    msg="Closing this window or navigating to another page will end your SomeGreatApp session.";
    window.event.returnValue=msg;
    And make a call to confirmExit() in the onBeforeUnload event of your main page.
    You'll notice I first check an 'appletRunning' variable before displaying the warning. This Javascript variable is set to true by my app when it starts up, using an embedded Javabean that calls out to Javascript. Once that variable is set to true, then the warning will be displayed if the user tries to shut the browser by clicking on the 'x' button, or to go to a different URL.
    When my app is shutting down, it uses the same Javabean to set appletRunning back to false. It then navigates to a close.htm - which will be done without a warning being displayed.
    See Re: How can a Javabean call Javascript function of the basejpi.html?? for example code on how to call Javascript from a bean embedded in your Forms app.
    Hope these ideas help you out, it's worked for me (so far, anyway!!)
    James

  • [svn:fx-trunk] 12077: Although Spark RichText does not support link formats , modifying compiled FXG to not generate ActionScript code that will cause compile time exceptions .

    Revision: 12077
    Revision: 12077
    Author:   [email protected]
    Date:     2009-11-20 18:16:32 -0800 (Fri, 20 Nov 2009)
    Log Message:
    Although Spark RichText does not support link formats, modifying compiled FXG to not generate ActionScript code that will cause compile time exceptions.
    Removing references to Flex Builder 3 in RPC.
    QE notes: N/A
    Doc notes: N/A
    Bugs:
    SDK-24305 - Link format property nodes cause errors on RichText in FXG 2.0
    SDK-24322 - A couple references to Flex Builder 3 in Flex 4 LangRef (and code comments)
    Reviewer: Deepa
    Tests run: checkintests
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-24305
        http://bugs.adobe.com/jira/browse/SDK-24322
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/xml/XMLDecoder.as
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/fxg/FlexFXG2SWFTranscoder.java

  • Task in Process Definition not Running when Trigger Automatically

    Hi All,
    I have created a task in Process Definition (eBusiness Suite User)and attached JAVA code to this task. Also i have triggered this task on C response of Email Updated Task . I also have Change Email Task which is mentioned in Lookup.USR_PROCESS.TRIGGERS lookup defination. so when Email id is changed in OIM Console it is triggering Change email Task and it is getting populate in Process form and as i am using Auto Save Feature .Email Updated task is geting Triggered. and Email is updated in FND_User table.
    Now my Problem is after Email Updated task is completed it is triggering my Task but my Task Is not getting Executed (JAVA code is not executed).
    But when I manually add this task from Resource History , JAVA code is getting Executed .
    What i founf is Email Updated task was triggered by OIMINternal User , So I add in Assignment tab to OIMInternal user , but no luck.
    Task is getting Triggered but is not getting Executed.
    Can any one suggest how i can run this task Automatiically.
    Please help. Its bit urgent.
    Thanks!!
    Regards,
    Tushar

    Once the process tasks has been executed you can not delete it.
    check these links for more info.
    Deleting a Process Task
    Re: Remove Unused Process Tasks from Process Definition for Export

  • Why does compiled (EXE) VI run when you double-cli​ck the icon even though I un-checked "Run When Opened"?

    My VI code uses the VI's that came with the NI  USB-8451  USB-to-SPI converter.  Before compiling I needed to use one of those VI's to select the particular USB device that I'm trying to address, then I click the Run button.  But after I compile my code into an EXE file, and then double-click the executable file it immediately starts running without allowing me to select the USB device - even though I un-checked the "Run When Opened" box.  In fact I also un-checked the Show Menu Bar and Show Scroll Bars boxes as well, yet it shows both of them.  What am I doing wrong?

    It seems silly to start and stop a built LabVIEW application from the toolbar. A complete application should always run and have the LabVIEW toolbar hidden. A user of you code is not supposed to be familiar with LabVIEW mechanics.
    You should do all this in code. Really!
    Do a nice state machine with at least two states. (1) a state for where the device has not been entered and is simply waiting for your input, and (2) another state that verifies your device input and hands it to the rest of the code for afterwards.
    Still, what LabVIEW version do you have. Did you set the "run when openend" setting in the application builder for the desired VI or just in the VI itself?
    LabVIEW Champion . Do more with less code and in less time .

  • Sound plays in stand-alone SWF, but not when SWF is loaded into another SWF

    I have my Main FLA (Main.SWF) into which I load another SWF (1.SWF).  I have a sound the plays in 1.SWF and it works just fine when I publish 1.SWF alone.  When I load 1.SWF into my Main.SWF and publish Main.SWF, the sound in the loaded 1.SWF no longer plays.  I can't figure out why.
    //Here's the code (AS2) in 1.SWF to play the sound; seems pretty straight forward.
    mySound = new Sound();
    mySound.attachSound("soundSWF1");
    mySound.start();

    I found some information on-line that helped me figure out how to fix this issue.  First, I moved the sound object code to the timeline of the movieclip in which I wanted to play the sound, even if the movieclip was in a loaded SWF.  So if I my sound should play in mc_1.mc_2.mc_3, the sound object is created in mc_3 timeline.  Also, when creating the sound object, "this" is placed as the parameter, as such:
    soundObject = new Sound(this);
    Also, when stoping the sound, I'm using stopAllSounds() instead of soundObject.stop().
    I hope this helps someone who is struggling with this same issue.

  • ActionScript class being run by mistake in Flex project

    I have a Flex project where my main MXML file is set as the
    one and only application file and is also set as the default file.
    I also have an ActionScript class in the project that extends
    Sprite. It is _not_ set as an Application file.
    When I have the ActionScript class selected, if I hit run or
    debug, FB3 creates a new launch configuration for it and tries to
    run the AS file instead of the default application MXML file.
    Needless to say, this is really annoying as it means I have
    to select the main MXML file before hitting debug/run every time.
    Is this a bug or feature? (Feels like a bug).
    Thanks,
    Aral

    Hi Aral,
    Can you please log it in our public bug system:
    http://bugs.adobe.com/flex?
    It'd be great if you can provide more info to the bug e.g.
    reproducible steps, platform, FB version (Plugin or Standalone).
    thanks,
    Sharon

Maybe you are looking for

  • HELP! iPhone 3GS stuck in recovery loop and iTunes gives error message" iPod update server can not be contacted"

    As I said, it's an iPhone 3GS (never jailbroken), iOS 4.1, PowerPC G4 OS X 10.4.11, iTunes 9.2. I have had the phone since new, never had any issues with it and am at my wits end trying to figure it out. I have seen many different solutions to this e

  • AR Open Conversion Load Issues

    Hi Friends, We are working on the AR Open Conversion load using LSMW and we are getting the error "Field BSEG-XREF1. does not exist in the screen SAPMF05A 0331" during batch input session (SM35).  Does anybody help me telling why we are getting this

  • Can I install Boot Camp 5 from Win 8?

    I have a late 2011 Mac Pro tower running Windows 8 and Boot Camp 4. I have had Windows 8 ever since it came out, that means that I upgraded to Windows 8 with the last version of Boot Camp 4 (with no issues BTW). Now there is Boot Camp 5,  and I want

  • None of the selected updates could be installed.  You don't have permission

    I am trying to update my MacMini from 10.7.3 to 10.7.4 and I am not able to.  The user account I am trying to do it from is an admin account.  I currently have 4 other updates and I am not able to install any of them and they are listed below. Airpor

  • No versions after import for customer objects

    Hi all! I have a little problem with transporting of (customer dictonary objects) and the versions. The system enviroment is SAP ECC 6, software level SAPKB70016 SAPKA70016 SAPKH60302 On the developer system the customer objects have versions - after