Controlling SWF with Javascript

Not sure if this is in the right place but I've been searching for a few days for how to do this. What I would like to accomplish is to create a set of javascript controls that would target a SWF file in an html file. The SWF file is basically a digital magazine and I'd like is to have a user click a button and then flip through the magazine forward and back and also be able to zoom in and out. Any help would be greatly appreciated! Thanks!

you can use javascript to communicate between flash and html.
use the externalinterface class to communicate between flash and
javascript.

Similar Messages

  • Controlling swf with html navigation

    I am building a site that is primarily HTML. The idea is to
    get a swf to play then after that is complete to finish with a show
    from a show hide code utilizing HTML. This would all take place
    from the HTML navigation and sub navigation.
    I know how to get this going using just flash but since this
    is an HTML web page I am at a loss of how to control the main swf
    using the HTML navigation.

    you can use javascript to communicate between flash and html.
    use the externalinterface class to communicate between flash and
    javascript.

  • Which is the best tool for PRC animation? and how to control it with javascript?

    Hi I created animations through Deep Exploration. But I want to know how to create PRC animation with tools and how to control it? I already tried with tetra4D but the javascript can control only u3d format. I have no idea to control prc animation. Please let me know.
    Thanks and Regards
    Chenet0005 @ Chenthil Kumar

    PRC files don't support embedded animations.
    You can still control the mesh directly with  3D JavaScript (e.g. by using rotateInPlace and a time event handler) but you can't import a timeline as you can with U3D.

  • Controlling SWFs with dynamic lengths

    I need to load SWF applications into my Director files.
    Currently, I am using the timeline with an arbitrary amount of
    time. My problem is that the length (playtime) of these SWFs are
    dependent on the end-user interactivity. If they press every
    button, answer every questions, etc… one viewer could be done
    in 5 minutes and another user could be done in 30 minutes. I have
    no way of determining. Currently, my timeline will run out and I
    send the users to a Menu screen. Is there a way to dynamically load
    a SWF and have it play indefinitely? I will have a button on the
    screen if the use wishes to exit early.
    Thanks in advance for any help with this problem!-
    |rossimo|

    EDIT: After
    trying out Rafael's suggestions, it looks like that has solved my
    problem. Thanks for the help Rafael!!
    Thanks for the reply Rafael!-
    No suggestion would be dumb. I am a Flash user trying to get
    terms with Director 11. I am still trying to wrap my head around
    the differences in timelines. I would have thought that would stop
    the playback of the SWF, but I think you may be correct! I will
    give that a shot and report back. More to come...
    |rossimo|

  • Controlling Flash timeline with Javascript

    I have a project I'm taking over from a Flash designer. The
    way he created the project isn't the way I would have done it, and
    I'm trying to salvage what is there. My question: Is it possible to
    control the timeline of an .swf from Javascript?
    Basically, the movie has four different sections, each noted
    with a frame label. I'd like to be able to have the user click on a
    text link in HTML, and using javascript, load the movie in a new
    window, and immediately go to the frame label specified.
    Is this possible?

    Yes, Flash and Javascript can communicate. I would try using
    the toolkit from
    http://weblogs.macromedia.com/flashjavascript/

  • Question about controlling embed quicktime object with javascript

    Hello,
    I am using javascript to control an embedded quicktime object on my website a la http://www.protofunc.com/2008/02/01/controlling-embedded-video-with-javascript-p art-i-quicktime/ .
    The problem I am having is with the movie.Stop() command. When I hit the pause button on the generic controller, it freezes the current frame. When I call the Stop() command, the movie goes white until it is resumed. Does the pause button do anything more than call "Stop()"?
    Thanks,
    Nick

    any luck with this? i am thinking of trying protofunc.
    fyi:
    i switched from SWF files to QuickTime H264, and have been trying to use the QuickTime/File/Save For Web feature on my movie promo web site.. all the movies play choppy on computers (desktops and laptops), but the technique works well on iPhones and iPads.. it is a bit unfair, IMHO, that apple can make trailers work so smooth on trailers.apple.com, but using their technology does not seem to work for "the rest of us"..
    any web sites other than apple that can help?

  • C# control event handling with javascript

    How can I get javascript to execute for "onchange" / "OnSelectedIndexChanged" event instead of a CodeBehind method? I think "OnSelectedIndexChanged" event has to be handled by CodeBehind; but how can I replace that (or onchange) with
    a javascript event handler?
    I have the following in my xyz.ascx file:
    <asp:DropDownList ID="ddlTypeCar" CssClass="BatsRefAddressTypes" runat="server"
                      onchange="javascript: testAlert();"
                      OnSelectedIndexChanged="ddlTypeCar_SelectedIndexChanged"
                      AutoPostBack="True" />
    I could not get the javascript to execute, even though I removed OnSelectedIndexChanged="ddlTypeCar_SelectedIndexChanged" and/or set AutoPostBack="false".
    Additionally, I tried added the following in xyz.ascx.cs Page_Load() method.
    ddlTypeOfAddress.Attributes.Add("onchange", "javascript: testAlert();");
    which didn't help.
    Thanks for your help in advance.

    Hi,
    you can control client events instead of server events with javascript
    look this url for more information
    http://www.w3schools.com/js/js_events.asp
    Regards

  • How to control Flash Player 10 with Javascript?

    Are there any turotials or examples of controlling Flash Player 10 from a web page with javascript?  I want the player to pop up when I mouseover a thumbnail image and play a short relevant flv file.  When the mouse moves away from the thumbnail the player should disappear.   I imagine I'm going to have something like
    <img src="thumbnail.jpg" onmouseover="javascript:  [call flv player with .flv name and parameters to autoplay with no controls )">
    but I don't know what the javascript code should be and I don't know how to embed the flv player in my HTML so the javascript code can call it. 
    Thanks for any help.
    Steve

    it would be nice if someone can suggest a solution.because i ve the same problem.
    Jon

  • Problem with Javascript and opening a new page

    Hi,
    I'm developping a website with Java Server Faces.
    I've a problem with JavaScript.
    I have a table, and each row of that table, has a button, to display more information about that specific row. I want to display this information in a new window. For this I want to use JavaScript.
    The new window, of course, needs some information of the other window, to show the right data.
    The first time I click the 'more-information-button', it works perfectly, but from than on, he keeps showing the same information...
    Here is my jsp-page of the first page (the one with the table):
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
        <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
        <f:view>
             <f:loadBundle basename="languages.MessageBundle" var="bundle"/>
            <html>
                <head>
                    <meta content="no-cache" http-equiv="Cache-Control"/>
                    <meta content="no-cache" http-equiv="Pragma"/>
                    <title>- UCV-Period -</title>
                    <link href="resources/stylesheet.css" rel="stylesheet" type="text/css"/>
                </head>
                <body style="-rave-layout: grid">
                        <h:dataTable binding="#{UcvPeriod.dataTable1}" headerClass="list-header" id="dataTable1" rowClasses="list-row-even,list-row-odd" rows="5"
                            style="left: 24px; top: 168px; position: absolute" value="#{UcvPeriod.dataTable1Model}" var="currentRow">
                            <h:column binding="#{UcvPeriod.column1}" id="column1">
                                <h:outputText binding="#{UcvPeriod.outputUcvPeriod}" id="outputUcvPeriod" value="#{currentRow['UCVPERIOD']}"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{UcvPeriod.outputText2}" id="outputText2" value="#{bundle.ucvPeriod_columnHeader_ucvPeriod}"/>
                                </f:facet>
                            </h:column>
                            <h:column binding="#{UcvPeriod.column11}" id="column11">
                                <h:commandButton action="#{UcvPeriod.btnDetails_action}" binding="#{UcvPeriod.btnDetails}" id="btnDetails" value="+" onclick="window.open('Details.jsp')"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{UcvPeriod.outputText21}" id="outputText21" value=""/>
                                </f:facet>
                            </h:column>
                        </h:dataTable>
                    </h:form>
                </body>
            </html>
        </f:view>
    </jsp:root>Here is my action, when someone clicks on the 'more-information-button':
    public String bthnDetails_action() {
       Object s = outputUcvPeriod.getValue();
       BigDecimal ucvPeriod = (BigDecimal)outputUcvPeriod.getValue();
       this.getSessionBean().setUcvPeriod(new Integer(ucvPeriod.intValue());
       return "detail_ucvperiod";
    }Here is my constructor of the Detailspage.
        public Details() {
             this.txtUcvPeriod.setValue(this.getSessionBean().getUcvPeriod());
        }Here is the navigation part for this part of my faces-config.xml .
    <navigation-rule>
       <from-view-id>/UcvPeriod.jsp</from-view-id>
       <navigation-case>
           <from-outcome>detail_ucvperiod</from-outcome>
           <to-view-id>/UcvPeriod.jsp</to-view-id>
       </navigation-case>
    </navigation-rule>Thx a lot....
    Anneke

    See the tutorial "Sharing Data Between Two Pages" at http://devservices.sun.com/premium/jscreator/standard/learning/tutorials/data_sharing_twopages.html and the FAQ "How can I pass data between pages without creating SessionBean variables in Creator?" at http://devservices.sun.com/premium/jscreator/standard/reference/faqs/technical/javasource/passing_data.html. Since you can open a new window when your button is clicked, the tutorial and FAQ will explain ways to pass your data to the new window.

  • Load SWF file in main SWF with parameters

    Hello everybody,
    I recently got a new flash Application which is a Photo Gallery.
    This App is made of multiple folders (source files), a FLA file, a SWF with its javascript SWFObject and an Html page which instantiate this App with some parameters (size, config file path, ...).
    It needs an XML file to find all the Photos it displays, to do it I need to configure my application in the HTML Page and give it the "xml_path" :
    var so = new SWFObject("index.swf", "gallery", "249", "249", "10", "#111111");
    so.addVariable("xml_path","load/config.xml"); // this line is adding the path to the xml file make sure that it's name is xml_path
    so.addParam("allowfullscreen","true"); 
    so.write("flashcontent");
    By the way, I have a second application, the WebSite, which have to display the Gallery SWF in its "Gallery" page.
    Here is how I do it at the moment (in ActionScript3) :
    var swfRequest:URLRequest = new URLRequest("C:/......../Galerie/index.swf");
    var swfLoader:Loader = new Loader();
    //Charge le SWF Galerie dans le SWF Site
    swfLoader.load(swfRequest, context);
    container1.addChild(swfLoader);
    //Positionne le SWF
    swfLoader.x=10;
    swfLoader.y=120;
    It successfully loads the Gallery application but It shows an error telling me it doesn't find the XML configuration file... In the HTML file I simply had to write the "so.addVariable("xml_path","load/config.xml");" to tell where the XML file is...
    So, my question is : How can I integrate my SWF application giving it some parameters like above, in Action Script 3?
    Thank you ,
    Patrick

    No, nothing with HTML.
    I have 2 SWF applications. One is the Gallery, and the second is my Main Page.
    My Main Page must integrate the Gallery module in one of its page.
    The problem is when I try to integrate it, I think I must give de future loaded SWF some parameters like this :
    (My Main SWF loading in HTML)
    var so = new SWFObject("WebSite.swf", "flashcontent", "520", "700", "10", "#111111");
    so.addParam("allowfullscreen","true");
    so.addParam("allowScriptAccess","always");
    so.addParam("menu","false");
    so.addParam("wmode","opaque");
    so.addParam("bgcolor","#000000");
    so.setAttribute("id","flash");
    so.write("flashcontent");
    It was for the Main App. For my Gallery SWF I had to load it like this (in HTML) :
    var so = new SWFObject("Gallerie.swf", "gallery", "249", "249", "10", "#111111");
    so.addVariable("xml_path","Galerie/config.xml"); // this line is adding the path to the xml file make sure that it's name is xml_path
    so.addParam("allowfullscreen","true"); 
    so.write("flashcontent");
    So at the beginning I had 2 different projects with an HTML page for each.
    Now I wan't to directly integrate the Gallery SWF into the Main SWF. And as you have seen I must give it some parameters such as the "xml_path" and "allowfullscreen". This must be done in ActionScript 3 and I don't know how...
    I think I have to use FlashVars but I don't know how. As I said before, I have tried using the loaderinfo.parameters, but it is in read-only...
    Do you have an idea of how I can make it work ?

  • Anyone been able to get the sap.ca.ui.FileUpload control working with a Gateway OData service?

    Hi,
    I have been trying to get the sap.ca.ui.FileUpload control working with an OData Gateway service, specifically /IWPGW/TASKPROCESSING which is the service used by both Fiori Approve Requests and the Unified Inbox.
    I have looked at the sample application in the Explored at SAPUI5 Explored
    I have managed to replicate that and get it to work, but as soon as I switch it from a JSONModel to an ODataModel I get javascript errors from within the setModel method of the control. I have redefined that method and corrected the errors, which enables me to get a bit further, but then I hit more errors, and other strange behaviour.
    Either I am doing something completely wrong, or to me it appears as if this control is still extremely buggy and maybe either not designed to work with an ODataModel, or just hasn't been tested using an ODataModel. I'm hoping it is my mistake.
    So has anybody out there successfully managed to use this control connecting it to a Gateway OData service? If so please share your experience.
    Thanks,
    Brad

    Hi Pauline,
    Same issue I had, I switched to using a sap.m.list and handling the press as follows:
    attachmentsList.bindItems(workItemPath + "/Attachments", new sap.m.StandardListItem({
                               type: sap.m.ListType.Active,
                               title: "{FileName}",
                               description: "{CreatedByName}",
                               icon: "sap-icon://doc-attachment",
    //                         counter: "{FileSize}",
                          info: {path : "CreatedAt", formatter: dateTimeFormatter},
                          tap: function(oEvent){
                                var oContext = oEvent.getSource().getBindingContext();
                                var media_src = oContext.getProperty().__metadata.media_src;
                                sap.m.URLHelper.redirect(media_src, true);
                        }), new sap.ui.model.Sorter("CreatedAt", true));
    So sap.m.URLHelper.redirect(media_src, true); is what loads the attachment.
    See the full function handler:
    function(oEvent){
    function(oEvent){
                  var oContext = oEvent.getSource().getBindingContext();
                  var media_src = oContext.getProperty().__metadata.media_src;
            sap.m.URLHelper.redirect(media_src, true);
    This should be enough if you only want to list and display the attachments, then you don't really need the FileUploader control as that is more advanced and handles upload, display, change and deletion of files.
    I only needed to upload and display files, so I used a list to display it and created a separate upload button using the sap.ui.unified.FileUploader control.
    Hope that helps.
    Cheers,
    Brad

  • Loaded external swfs with transitions

    I need help getting my loaded swf files to play the "out" transition before the next movie loads. I have a main swf with 5 buttons (movie clips) that load external swf onto the stage.
    package
        import flash.display.MovieClip;
        import flash.display.SimpleButton;
        import flash.display.Loader;
        import flash.net.URLRequest;
        import flash.events.MouseEvent;
        import flash.events.*;
        public class V2 extends MovieClip
            private var sections_array:Array;
            private var section_buttons_array:Array;
            private var loader:Loader;
            private var sectionHolder  : MovieClip;
            private var swf:String;
            private var currentSection:int=0;
            private var nextSection:int;
            private var id:int=0;
            private var homeLoc = "./swfs/home.swf";
            public function V2()
                init();
            private function init():void
                stop();
                stage.frameRate=31;
                preloader_mc.visible=false;
                preloader_mc.fill_mc.width=0;
                sectionHolder = new MovieClip();
                sectionHolder.x = 37;
                sectionHolder.y = 42;
                addChild( sectionHolder );
                sections_array = new Array('./swfs/section1.swf',
                './swfs/section2.swf',
                './swfs/section3.swf',
                './swfs/section4.swf',
                './swfs/section5.swf');
                section_buttons_array = new Array(btn1,btn2,btn3,btn4,btn5);
                addMenuListener();
                addMenuEvents();
                loadHome();
            private function addMenuListener():void
                for(var i:int=0;i < section_buttons_array.length;i++)
                    section_buttons_array[i].id=i;
                    section_buttons_array[i].addEventListener(MouseEvent.MOUSE_DOWN,loadSectionHand ler);
            private function loadHome():void
                swf=homeLoc;//sections_array[0];
                var request:URLRequest=new URLRequest(swf);
                loader=new Loader();
                initListeners(loader.contentLoaderInfo);
                loader.load(request);
                id=0;
            private function changeSection(m:MouseEvent):void
                id=m.currentTarget.id+1;
                loader.unload();
                sectionHolder.removeChild(loader);
                removeListeners(loader.contentLoaderInfo);
                loadSection(m.target.parent.id+1);
            private function loadSectionHandler(evt:MouseEvent)
                id = evt.currentTarget.id;
                loadSection(id);
            private function loadSection(n:int):void
                swf=sections_array[id];
                var request:URLRequest=new URLRequest(swf);
                initListeners(loader.contentLoaderInfo);
                loader.load(request);
            private function initListeners(dispatcher:IEventDispatcher):void
                dispatcher.addEventListener(Event.OPEN,start);
                dispatcher.addEventListener(ProgressEvent.PROGRESS,atLoading);
                dispatcher.addEventListener(Event.COMPLETE,completed);
            private function removeListeners(dispatcher:IEventDispatcher):void
                dispatcher.removeEventListener(Event.OPEN,start);
                dispatcher.removeEventListener(ProgressEvent.PROGRESS,atLoading);
                dispatcher.removeEventListener(Event.COMPLETE,completed);
            private function start(event:Event):void
                preloader_mc.visible=true;
            private function atLoading(event:ProgressEvent):void
                var n:uint=(event.bytesLoaded/event.bytesTotal)*100;
                preloader_mc.fill_mc.width=n;
               private function completed(event:Event):void
                sectionHolder.addChild(loader); 
                preloader_mc.visible=false;
            private function stopAll():void
                for(var i:int=0;i < section_buttons_array.length;i++)
                    section_buttons_array[i].stop();
                    sections_array[i].stop();
            private function addMenuEvents():void
                for(var i:int=0;i < section_buttons_array.length;i++)
                    section_buttons_array[i].mouseChildren=false;
                    section_buttons_array[i].buttonMode=true;
                    section_buttons_array[i].id=i;
                    section_buttons_array[i].isPressed=false;
                    section_buttons_array[i].addEventListener(MouseEvent.MOUSE_OVER,setOver);
                    section_buttons_array[i].addEventListener(MouseEvent.MOUSE_OUT,setOut);
                    section_buttons_array[i].addEventListener(MouseEvent.MOUSE_DOWN,setDown);
                    section_buttons_array[i].addEventListener(MouseEvent.MOUSE_UP,setUp);
            private function setOver(evt:MouseEvent):void
                if(evt.target.isPressed==false)
                    evt.target.gotoAndStop(2);
            private function setOut(evt:MouseEvent):void
                if(evt.target.isPressed==false)
                    evt.target.gotoAndStop(1);
            private function setDown(evt:MouseEvent):void
                nextSection=evt.target.id;
                checkState(evt.target.id);
                evt.target.gotoAndStop(3);
                loadSection(1);
                currentSection=evt.target.id;
            private function setUp(evt:MouseEvent):void
                if(evt.target.isPressed==false)
                    evt.target.gotoAndStop(1);
            private function checkState(n:int):void
                for(var i:int=0;i < section_buttons_array.length;i++)
                    if(i==n)
                        section_buttons_array[i].isPressed=true;
                    else
                        section_buttons_array[i].isPressed=false;
                        section_buttons_array[i].gotoAndStop(1);
            private function removeSWF(e:Event):void
                loader.unload();
                removeEventListener("removeMe", removeSWF);
                var request:URLRequest = new URLRequest(swf);
                loader.load(request);
            private function onClick(e:MouseEvent):void
            targetID = e.currentTarget.id;
            addEventListener("removeMe", removeSWF);
            MovieClip(loader.content).play();
            private function removeSWF(e:Event):void
            loader.unload();
            removeEventListener("removeMe", removeSWF);
    The loaded swf has a stop() an intro animation and on the last frame have.
    dispatchEvent(new Event("removeMe", true));

    your isse begins here ..
    loadSection()
    you use the same loader to not only load files but you are tyring to use it to target the movieClip you also want to play.
    The issue is loader.  The loader can only reference one load at a time.. otherwise you screw up your listeners and the ability to unload files properly.
    You should load all files in Your current system as its own variable so that while one loads you can still control a movie.
    So what type of end transitions do your files have?
    What exactly with this seems like youre getting an issue.. looking at it looks alright aside from the fact that some methods are not used at all by your class

  • Setting User Preferences With Javascript In Acrobat X

    Hi All,
    Is there a way thru Javascript to programatically set a value in the User Preferences?
    I am trying to create a batch sequence that exports PDFs to HTMLs. In the Acrobat X preferences, there is a conversion option that sets the option of "Run OCR If Needed" to true or false.
    Edit --> Preferences --> Convert From PDF --> HTML --> Run OCR if needed (True|False)
    Depending on conditions, I need to programtically set the value of this preference during the batch sequence before I export the document to HTML. Is this possible? Any help would be greatly appreaciated.
    Thank you,
    Teri

    There are very few user preferences that can be controlled with JavaScript, and this isn't one of them.

  • Change the value of a SharePoint List lookup control value using javascript

    hi,
    could you please help in changing the value of a SharePoint List lookup control value using javascript.
    Please note that i have to change the lookup value which is in the form of a drop down from the infopath form.
    Thanks

    https://stackoverflow.com/questions/5678210/select-dropdown-menu-option-with-javascript
    Does that help?

  • How to control animation with touch

    Hello! I need some help with controlling animations with touch. I am building a fake app and need to 'unlock' an iphone (slide an arrow along a track and then have it fade into another page). I have been using http://forums.adobe.com/message/4865693 that thread. The prototype link listed there is similar to waht I need to recreate, but I think I need an 'on touch' actino instead of a mousemove one.
    http://assets.ordienetworks.com.s3.amazonaws.com/the_occasional/checkerPro/checkerPro.html
    That is a link to the Edge file I have been working on, using the info in the thread above. It is broken at the moment, and I am terrible with javascript and have no idea how to move forward. I have figured that I'll need an 'on touch' action instead of the mouseover one, but I'm not sure how to build it.
    If there is a working example of this on a different thread that I've missed I'd love a link as well!!
    Thank you!!

    Hi, akall-
    There are a number of touch events that you can use to accomplish what you want.  You can try using the touchmove event instead of the mousemove event, and stick your code in there.
    Hope that helps,
    -Elaine

Maybe you are looking for

  • Creating a server hosting a bootable OS X to be accessible over the internet

    Hello all, I have been trying to turn my iMac 27' (3.5GHz, 32GB, late 2013 model) to a home server. The OS and all files are currently on an external drive from which I have been booting. I also have an Airport Extreme router plugged into my modem wh

  • About this forum

    hi i used to surf this forum using outlook express. it doesn't work any more. why? is it only web now? lenny

  • Assassin's Creed on MacBook Pro 13 inch

    I just bought new MacBook Pro 13 inch and i want to play Assassin's Creed II on it. In appstore i read, that this game is not compatible with my computer, but many peoples say that is playble. Do you know anyting about it, because I don't want pay fo

  • Copliling Solaris kernel module code in 64bit for AMD64

    Hi, I have solaris10 OS in my HP ProLiant DL-145 server machine I m using SunStudio C compiler (cc) for compling my kernel module source code. My code is successfully work in 32bit kernel mode. But when i boot the OS in 64bit mode & complile the same

  • User exit for ME22N in throwing an error message.

    Dear Experts, I have a requirement here : PO is created, and see it in ME22N ,we see line items. In a line item when we make changes in PO Quantity or value and save it, then Select the line item and Go to -> Environment-> Item changes. It takes to a