several buttons with very similar functions

I use the code has a button that adds a MC to step below. The problem is that I have over a dozen of these buttons and I would rather not write the listener of events and the function for every single button. Is there a way to use a single function for all buttons and just change that MC is added based on which button is clicked? So if the user clicks the button draw5 function adds the MC deck5 to the scene?

var drawnCard:MovieClip

Draw1.addEventListener (MouseEvent.MOUSE_DOWN, dealTheCard);

var alreadyDrawn:Boolean = false

function dealTheCard(event:MouseEvent):void {}

if (alreadyDrawn == true) {}

this.removeChild (drawnCard);

trace ("removed card")

}

drawnCard = new deck1();

alreadyDrawn = true

addChild (drawnCard);

drawnCard.x = 60;

drawnCard.y = 50;

drawnCard.gotoAndStop (Math.ceil (Math.random () * 11))

}

use:

kglad wrote:

var drawnCardObj:Object = {};

var tl:MovieClip =;

for (var i: int = 1; i<>

TL ['draw' + i] .addEventListener (MouseEvent.MOUSE_DOWN, dealTheCard);

.Ivar TL ['draw' + i] = i;

}

var alreadyDrawn:Boolean = false

function dealTheCard(event:MouseEvent):void {}

If (drawnCardObj [MovieClip (event.currentTarget) .ivar]) {}

tl.removeChild (drawnCardObj [MovieClip (event.currentTarget) .ivar]);

}

var classRef: Class = Class (getDefinitionByName ("bridge" + MovieClip(event.curre_ntTarget).ivar));

var drawnCard: * = new classRef();

drawnCardObj [MovieClip (event.currentTarget) .ivar] = drawnCard;

tl.addChild (drawnCard);

drawnCard.x = 60;

drawnCard.y = 50;

drawnCard.gotoAndStop (Math.ceil (Math.random () * 11))

}

Tags: Adobe Animate

Similar Questions

  • Several buttons with a code

    I copied the style (Visual Style of copy) of a single button and multiply it a few more buttons.

    Problem is in the code. Each button has own id and for this clean css tag. Css file looks very dirty and long

    Is not enough smart reflow to use classes, tCap can more identical element have the same class in the code?

    Classes using CSS is something that we would like to add to reflow, but we have not yet done.

    VIC

  • Cp6: How to stop a slide with several buttons in a nonlinear presentation?

    Hello

    I would be very grateful for a solution to this issue, as I failed to find one yet in this forum.

    The presentation is non-linear, which means that the first slide is a kind of menu that you can choose another slide to explore and always comes back to the first.

    Each slide has several buttons that activate different audio files, and there is a button on the arrow in the lower right corner to jump to the first slide.

    The problem is that the slide does not stop after that you click on some of the audio buttons and continue on the next slide (instead of take a break until the user clicks on the arrow button). When I click a few buttons and listen to audio, eventually the slide automatically continues to the next slide.

    I tried:

    • Add button click box with "break project up to what the user clicks
    • change all the buttons for timing-> break after...
    • change only the arrow for Timing-> button pauses after...
    • and will not take unnecessarily long time to slide

    Any ideas?

    Thanks in advance,

    The best

    Acted

    You don't say 'how' to play the audio? In any case, the default behavior of interactive objects that trigger a simple action is out the read head. If you replace the simple action by a standard tip action one line, the playhead is not released. Watch this video (posterous is down once, again can not point to my blog):

    http://www.YouTube.com/watch?v=M3nKi-DB6Fw

    Lilybiri

  • ScriptUI Palette with button to perform the function

    Hey Hey. Ho ho. I have a question for you guys. Hey Hey. Ho ho.

    So I'm writing a script to automatically replace art existing in a file with the art of my network (specifically, necklaces. we work that says "made in usa" but we moved production overseas, then update the country of origin.) I have fixed all our model files, new orders are set up correctly, but we have tens of thousands of old orders with bad collars in the files. so far we have been manually accessing the network, opens a file that contains the correct collars and paste in the required file. A PITA serious, especially when you do 20 - 30 times per day.

    So, naturally, I started to think about how to automate it. For most files, this process is really simple and straightforward because the files that we use has set up a system of good address. However, orders more alumni dating back to before the address system, so the script in some cases, to do a break in order to let the artist select USA collars so that the script can move to a new layer and hide.

    To remedy this, I decided to use a scriptUI as an alert box pallet (if the artist still has access to the user interface, so they can select the necessary art, then click a button to perform a function and complete the task. The button in the palette works to perform the desired function, but then I get an error in ESTK that "there is no document. What I'm doing wrong here? Everything works until the promptToSelectCollars() function; The error occurs at line 291 trying to use docRef.layers.add (); I added the line 290 after the first time I got the error to see if docRef just need to be redefined, but that did not help.

    I guess I can just force the artist to select any work necessary before running the script, but I like it to be as smooth as possible and requires a minimum of steps pre...

    Here's the current code (must still be completed, I know)... Any thoughts?

    //Add DR Collars
    
    
    function container()
    {
    
    
        /////////////////////
        ///Logic Container///
        /////////////////////
    
    
        function whatStyleDialog()
        {
            // var docRef = app.activeDocument;
    
    
            var sports = ["SLOW_SS", "SLOWW_SS", "SLOWY_SS", "FAST_SL", "FAST_RB", "FAST_FB_SL", "FAST_FB_SS", //
            "FAST_2B_SS", "BASE_FB_SL", "BASE_FB_Y_SL", "BASE_FB_SS","BASE_FB_Y_SS", "BASE_2B_SS", "BASE_2B_Y_SS"];
    
    
            
    
    
            var wS = new Window("dialog", "What Collars Do You Need?");
    
    
            var inputGroup = wS.add("group");
                inputGroup.orientation = "column";
                var sportsGroup = inputGroup.add("group");
                    sportsGroup.add("statictext", undefined, "Choose Sport");
    
    
                    //populate sports dropdown list
                    var sportsList = sportsGroup.add("dropdownlist", undefined, sports);
                    sportsList.selection = 0;
    
    
                var styleGroup = inputGroup.add("group");
    
    
                    styleGroup.add("statictext", undefined, "Enter Style Number:");
    
    
                    //input text box for style number
                    var styleInput = styleGroup.add("edittext", undefined, "000");
    
    
            var buttonGroup = wS.add("group");
                var okButton = buttonGroup.add("button", undefined, "OK");
                var cancelButton = buttonGroup.add("button", undefined, "Cancel");
    
    
    
    
            if(wS.show() == 1)
            {
                var results = "";
                results = "FD_" + sportsList.selection.text + "_";
                results = results + styleInput.text + ".ait";
                return results;
            }
            else
            {
                return null;
            }
        }
    
    
        function getStyle(styles)
        {
            if(styles.length>1)
            {
                var result;
                var gS = new Window("dialog","Which Garment?");
                    var titleText = gS.add("statictext", undefined, "Which Garment Do You Need Collars For?");
                    var buttons = styles;
                    var buttonGroup = gS.add("group");
                    buttonGroup.orientation = "column";
                        for(var s=0;s<styles.length;s++)
                        {
                            addButton(s, styles[s]);
                        }
    
    
                    function addButton(num, style)
                    {
                        buttons[num] = buttonGroup.add("button", undefined, style);
                        buttons[num].onClick = function()
                        {
                            result = style + ".ait";
                            gS.close();
                        }
                    }
                gS.show();
                // alert(result)
                return result;
    
    
            }
            else
            {
                result = styles[0] + ".ait";
                return result;
            }
        }
        function whatGarment()
        {
            var result;
            var jerseyList = [];
    
    
            for(a=0;a<layers.length;a++)
            {
                if(layers[a].name.indexOf("FD")>-1)
                {
                    jerseyList.push(layers[a].name);
                }
            }
    
    
            //This prepress is not on a template
            if(jerseyList.length==0)
            {
                result = whatStyleDialog();
                return result;
            }
    
    
            else
            {
                result = getStyle(jerseyList);
            }
    
    
            return result;
        }
    
    
        function findCAD(path, garment)
        {
            var loc = new Folder(path);
            var theFile = new File(loc + "/" +  garment);
            return theFile;
        }
    
    
        function copyCollars(theCAD,coords)
        {
            var collars = [];
            var collarSource = open(theCAD);
            var sourceLayer = collarSource.layers[0].layers["Prepress"];
            var curLay;
            var curGroup;
    
    
            sourceLayer.visible = true;
    
    
            collarSource.selection = null;
    
    
            for (var a=0; a< sourceLayer.layers.length;a++)
            {
                curLay = sourceLayer.layers[a];
                for(var b=0;b<curLay.groupItems.length;b++)
                {
                    curGroup = curLay.groupItems[b];
                    if(curGroup.name.indexOf("Collar")>-1)
                    {
                        curGroup.selected = true;
                    }   
                }
                
            }
    
    
            app.executeMenuCommand("copy");
            docRef.activate();
            app.executeMenuCommand("paste");
    
    
            for(var a=0;a<docRef.selection.length;a++)
            {
                var curGroup = docRef.selection[a];
                var curName = curGroup.name.substring(0,curGroup.name.indexOf(" "));
                curGroup.left = coords[curName][0];
                curGroup.top = coords[curName][1];
            }
    
    
            
    
    
            // collarSource.close(SaveOptions.DONOTSAVECHANGES);
            
        }
    
    
        function addCollarsToCorrectLayer(garment,coords)
        {
            try
            {
                var theLayer = docRef.layers[garment.substring(0,garment.indexOf(".ait"))].layers["Prepress"];
                theLayer.visible = true;
                // alert("theLayer = " + theLayer);
                // alert(docRef.selection.length);
                for(var a=docRef.selection.length-1;a>-1;a--)
                {
                    var thisCollar = docRef.selection[a];
                    var targetLayer = theLayer.layers[thisCollar.name.substring(0, thisCollar.name.indexOf(" "))];
                    thisCollar.moveToBeginning(targetLayer);
                }
    
    
    
    
            }
            catch(e)
            {
                try
                {
                    if(docRef.selection[0].layer != "[Layer Artwork]")
                    {
                        var theLayer = docRef.layers["Artwork"];
                        theLayer.locked = false;
                        theLayer.visible = true;
                        for(var a=docRef.selection.length-1;a>-1;a--)
                        {
                            docRef.selection[a].moveToBeginning(theLayer);
                        }
                    }
                }
                catch(e)
                {
                    alert("something went wrong")
                }
            }
            if(theLayer.name == "Prepress")
            {
                var drCollarLabel = docRef.layers[0].layers["Mockup"].textFrames.add()
            }
            else
            {
                var drCollarLabel = theLayer.textFrames.add();
            }
            drCollarLabel.contents = "DR Collars";
            drCollarLabel.left = coords["Label"][0];
            drCollarLabel.top = coords["Label"][1];
            drCollarLabel.textRange.characterAttributes.size = 36;
        }
    
    
        function promptToSelectCollars()
        {
            alert("running prompt to select");
            var selCol = new Window("palette");
                var text = selCol.add("statictext",undefined, "Select the USA Collars and click OK");
                var button = selCol.add("button", undefined, "OK");
                button.onClick = function()
                {
                    selCol.close();
                    moveCollarsToUSALayer(false);
                }
            selCol.show();
        }
    
    
        function moveCollarsToUSALayer(template,garmentLayer)
        {
            if(template)
            {
                var usaLayer = garmentLayer.layers.add();
                usaLayer.name = "USA Collars";
                var theLayer = garmentLayer.layers["Prepress"];
    
    
                for(var a=0;a<theLayer.layers.length;a++)
                {
                    var curSize = theLayer.layers[a].name;
                    var curLay = theLayer.layers[a];
                    curLay.groupItems[curSize + " Collar"].moveToBeginning(usaLayer);
                }
    
    
                continueScript();
            }
            else
            {
                // docRef = app.activeDocument;
                var usaLayer = docRef.layers.add();
                usaLayer.name = "USA Collars";
    
    
                for(var a=0;a<docRef.selection.length;a++)
                {
                    var curCollar = docRef.selection[a];
                    curCollar.moveToBeginning(usaLayer);
                }
                continueScript();
            }
            
    
    
    
    
        }
    
    
        function continueScript()
        {
            var theCAD = findCAD(garmentInfo[garmentCode]["path"], garment);
    
    
            copyCollars(theCAD, garmentInfo[garmentCode]["coords"]);
    
    
            addCollarsToCorrectLayer(garment,garmentInfo[garmentCode]["coords"]);
        }
    
    
        /////////////////////
        ///Logic Container///
        /////////////////////
    
    
        var docRef = app.activeDocument;
        var layers = docRef.layers;
        
    
    
        var garmentInfo = 
        {
            "FD_SLOW_SS" : 
            {
                "path": "/Volumes/Customization/Library/cads/prepress/FD_SLOW_SS/ConvertedTemplates/FD_SLOW_SS",
                "coords" : 
                {
                    "XS" : [-946.67,622.35],
                    "S" : [-948.92,362.97],
                    "M" : [-951.17,96.54],
                    "L" : [-953.42,-177.48],
                    "XL" : [-955.22,-458.71],
                    "2XL" : [-957.92,-747.11],
                    "3XL" : [-960.17,-1042.73],
                    "4XL" : [-962.42,-1345.42],
                    "5XL" : [-964.67,-1654.82],
                    "Label" : [-949.1,708.39]
                }
            },      
            "FD_SLOWW_SS" : "/Volumes/Customization/Library/cads/prepress/FD_SLOW_SS/ConvertedTemplates/FD_SLOWW_SS",
    
    
            "FD_SLOWY_SS" : "/Volumes/Customization/Library/cads/prepress/FD_SLOW_SS/ConvertedTemplates/FD_SLOWY_SS",
            "FD_FAST_RB" : "/Volumes/Customization/Library/cads/prepress/FD_FAST_RB/Converted_Templates/",
            "FD_FAST_SL" : "/Volumes/Customization/Library/cads/prepress/FD_FAST_SL/Converted_Templates/",
            "FD_FAST_FB_SL" : "/Volumes/Customization/Library/cads/prepress/FD_FAST_FB_SL/Converted_Templates/",
            "FD_FAST_FB_SS" : "/Volumes/Customization/Library/cads/prepress/FD_FAST_FB_SS/Converted_Templates/",
            "FD_FAST_2B_SS" : {
                "path": "/Volumes/Customization/Library/cads/prepress/FD_FAST_2B_W_SS/Converted_Templates/",
                "coords" : 
                {
                    "XXS" : [-1011.89,455.31],
                    "XS" : [-1015.33,206.79],
                    "S" : [-1018.88,-60.25],
                    "M" : [-1022.12,-323.7],
                    "L" : [-1025.7,-595.67],
                    "XL" : [-1028.83,-879.72],
                    "2XL" : [-1032.38,-1168.08],
                    "3XL" : [-1035.83,-1457.79],
                    "Label" : [-949.1,708.39]
                }
            },
            "FD_BASE_FB_SL" : "/Volumes/Customization/Library/cads/prepress/FD_BASE_FB_SL/Converted_Templates/",
            "FD_BASE_FB_Y_SL" : "/Volumes/Customization/Library/cads/prepress/FD_BASE_FB_Y_SL/Converted_Templates/",
            "FD_BASE_FB_SS" : "/Volumes/Customization/Library/cads/prepress/FD_BASE_FB_SS/Converted_Templates/",
            "FD_BASE_FB_Y_SS" : "/Volumes/Customization/Library/cads/prepress/FD_BASE_FB_Y_SS/Converted_Templates/",
            "FD_BASE_2B_SS" : "/Volumes/Customization/Library/cads/prepress/FD_BASE_2B_SS/Converted_Templates/",
            "FD_BASE_2B_Y_SS" : "/Volumes/Customization/Library/cads/prepress/FD_BASE_2B_Y_SS/Converted_Templates/",
        }
    
    
        var garment = whatGarment(); 
    
    
        var garmentCode = garment.substring(0, garment.indexOf("_0"));
    
    
        var styleNum = garment.substring(garment.indexOf("_0"), garment.length);
    
    
        try
        {
            docRef.layers[garment.substring(0,garment.indexOf(".ait"))].layers["Prepress"].visible = true;
            moveCollarsToUSALayer(true,docRef.layers[garment.substring(0,garment.indexOf(".ait"))]);
    
    
        }
        catch(e)
        {
            //no discernable layer structure
            alert("using catch");
            promptToSelectCollars();
        }
    
    
        
    
    
        
    
    
        
    
    
        // alert("Results:\n" + "Sport: " + garment[0] + "\nCut: " + garment[1] + "\nStyle Number: " + garment[2]);
        // alert("Results:\n" + garment);
    
    
    
    
        
    }
    container();
    

    You do not have something wrong, sort of, pallets do not 'normally' work as do dialog windows, you must use BridgeTalk to bind your palette to Illustrator, do a quick search, a topical subject, there are many samples.

  • Plans of work in PS CC can be also for print design? If not, is it possible to use photoshop with similar functionality?

    Plans of work in PS CC can be also for print design? If not, is it possible to use photoshop with similar functionality?

    As they don't understand the area of cropping and Bleedbox parameters so far that they are, in my opinion, useless in regards to printing.

    If you try to make prepress and correct page layout work in Photoshop, you can change to use the right tools for the task as Indesign.

  • two buttons with single function

    I want to create two buttons for single function and a single button for a function. For example, I click on button1, the display shows "clicked1".

    If I clicked on button2, the display shows "clicked2". If I click on button1, and then click button2, it will show that "the two buttons are clicked. However, it does not work in two buttons with single function. What is the problem? Here's the code.

    import flash.display.MovieClip;

    import flash.events.MouseEvent;

    var button1:MovieClip = new Button1();

    Button1.x = 200;

    Button1.y = 200;

    addChild (button1);

    var button2:MovieClip = new Button2();

    Button2.x = 300;

    Button2.y = 250;

    addChild (button2);

    Button1.addEventListener (MouseEvent.CLICK, onClick);

    Button2.addEventListener (MouseEvent.CLICK, onClick2);

    var isClicked:Boolean;

    var isClicked1:Boolean;

    function onClick(evt:MouseEvent):void {}

    isClicked = true;

    trace ("clicked1");

    }

    function onClick2(evt:MouseEvent):void {}

    isClicked1 = true;

    trace ("clicked2");

    }

    If (isClicked & & isClicked1) {}

    trace ("two buttons are clicked");

    }

    Copy the following code

    If (isClicked & isClicked1) {}

    trace ("two buttons are clicked");

    }

    should run WHEN you click on your buttons.  That is to say, place it in a function and call that function when you click on your buttons and after that your Boolean values are updated.  (probably then want to reset these Boolean values in the called function).

  • With the help of several buttons on a slide

    I am a new user of Captivate 4 and I have questions with several buttons on a single slide.

    I want a button each to send to users in three different places depending on the button pressed. The locations are all in the current movie that I am developing.

    My problem is that using a button or click box is an action "pass" and "fail". When you use the two buttons in a slide I was creating a dummy "button and get the users click on this 'button' where there are only two choices. This procedure meets the success of failure on the button or click box.

    Of course, I can't do this job when I need more of two buttons.

    I must be missing something simple here any advice would be appreciated.

    See you soon

    thedarf

    Hello

    I'm a bit confused. You say you want to provide only two choices? (Or are you want to create a slide where it acts much like a table of contents when the user clicks the button or click box) 1 and moves might slide 5, button 2 moves to maybe slide 10 and 3 button move maybe slide 15.

    If this is the case, you are overthinking things. All you need to worry is the action of onSuccess.

    See you soon... Rick

    Useful and practical links

  • Several buttons that links to several pages of a film

    Hi all

    I have an animation flash with 3 buttons, I'm relativley a link to pages on my site, I have a very good job but can't get others to post a link and when I try it makes one that works, works not more...

    Below is the code I use one that works;

    import flash.events.MouseEvent;
    var getIndex:URLRequest = new URLRequest("..) ("/ index.html");

    -Enter button-------.

    E_btn.addEventListener (MouseEvent.CLICK, bclick);

    function bClick(event:MouseEvent):void {}
    navigateToURL (getIndex, "_self");
    }

    Still a bit of a beginner in flash so any help really appreciated.

    Thank you very much

    I see that code for a button there, so I can only guess repeat you the same function several times.  You cannot use the same name for different functions, and you can have the same duplicate function.  Similarly, you cannot declare more than once to the same variable.  You can have buttons share the same function but, and you can assign new values to variables.

    For now, start by creating a unique function for each button definition.

    For further discussion, if your buttons are movieclips you can assign the url to them as variables, or if you name your buttons by using page names they bind to, then the same function could be shared with a few generic tweaks.

  • Several problems with Adobe Creative cloud app.

    I have several problems with the Adobe Creative Cloud application.

    1 CC Photoshop or prelude CC cross the bar of the 47% during installation. They constantly give me messages "Installation failed". When I click on "Learn more", I like that:

    "Installation failed."

    Errors during Installation. (7)

    More information"

    So, naturally, I click on more information to get the lifting against me following (which no do I understand):

    Exit Code: 7 Please see specific errors below for troubleshooting. For example,  ERROR:   -------------------------------------- Summary --------------------------------------  - 0 fatal error(s), 2 error(s)    ERROR: 12/01/13 13:16:06:425 | [INFO] |  | OOBE | DE |  |  |  | 6076 | ---------- CustomHook_Helperx64 ---- Start ----------  12/01/13 13:16:06:426 | [ERROR] |  | OOBE | DE |  |  |  | 6076 | Cannot load function name 'CSInstallerCustomHookProc' from library C:\Program Files (x86)\Common Files\Adobe\Installers\uninstall\{5F816B76-62F3-41C9-B651-27F49F25F50B}.data. Error 0    ERROR: System check returned with error : -4  ------------------------------------------------------------------------------------- 

    2. I installed 5 Lightroom, then uninstalled. When I went back to re - install, the application Adobe Creative cloud wouldn't let me. He says that my 5 Lightroom is "up-to-date" and that it is in my article 'Your applications', not in the section 'find new applications '. I rechecked my programs and features in Control Panel, and it isn't here. I cleaned my registry and it is still there. I deleted the file "opm.db" in my OOBE folder and restarted CC - still nothing.

    I must say, guys. I'm not very happy with the time I spent just trying to install programs on my PC. While the plan is for it to be intuitive at a certain time, it is not very functional at the moment. No matter how much help you can provide me would be amazing - if you can provide it sooner than later, I'd be on the moon.

    Thank you.

    Hope this will help others record the amount of time this error I spent troubleshooting.  When you install Adobe InCopy CC, CC of Adobe InDesign, Adobe Photoshop CC, CC prelude Adobe and Adobe first Pro CC on a laptop Windows Pro 8.1, I an error similar to the one below.  Other installations of Adobe Acrobat XI Pro, Adobe affect effects CC, Adobe Audition CC, Adobe Bridge CC, CC of Adobe Illustrator, Adobe Lightroom 5 and Adobe SpeedGrade CC installed without error.  I ran across this test with a clean operating system, new construction to help isolate the problem.

    23/12/13 16:33:04:372 | [INFO] |  | OOBE. OF |  |  |  | 912 | 23/12/13 16:33:03:368 | [ERROR] |  | OOBE. OF |  |  |  | 6316 | Cannot load the name "CSInstallerCustomHookProc" C:\Program Files (x 86) library function \Common Files\Adobe\Installers\uninstall\{5F816B76-62F3-41C9-B651-27F49F25F50B}.data. Error 0

    I ran a minimum load of the operating system by stopping all non Microsoft services by running MSCONFIG. EXE and disabling and disabling all startup in the Task Manager, Startup tab items.  After restarting the laptop, I was then able to install CC of Adobe Photoshop and Adobe first Pro CC.  However, Adobe InCopy CC, CC of Adobe InDesign and Adobe prelude always failed CC.  I needed to start safe mode and disable BitDefender Virus Shield and BitDefender Desktop Update Service and then restart mode Normal (services were always disabled). I continued and completed the installations of Adobe InCopy CC, CC of Adobe InDesign and Adobe prelude CC.

    It seems that BitDefender is the process to load this function as a virus Trojan markup and stop installation.

  • Disappear several buttons to create the message window after installing Enigmail and GNUpg

    Hello.

    I decided to install the Thunderbird PGP module (Enigmail). During the installation, it was necessary to install additional software GnuPG. After restart Thunderbird in create message windows several buttons disappear as: fonts, links, etc. (see photo).

    I uninstalled Enigmail and GnuPG, but the situation with row of missing button has not changed.

    I installed the new Thunderbird software at the top of the old installation and don't change the situation with row of button disappeared.

    I repeat the installation on a new computer to get started with Thunderbird and after that with Enigmail and GNUPG and I got the same result with line disappears in create message window.

    Thank you in advance.
    Cryospin

    Enigmail works very well with HTML email. That's why default Enigmail to plain text message composition. The installation wizard did ask you if it
    should these settings and let you inspect these changes.
    You must undo the changes in the settings of your account under Composition & addressing. Just check "compose messages in HTML format.

  • Can I have several structures with the same case of event event?

    Hello

    I do an application which reproduces the front of the power supply HP6675A. To do this, I did a machine to States with different States

    (initialize, measures, voltage, current, ocp, ov, store, recall, etc.). In each State, should have a structure of the event that attracts the events of the buttons, as for example: If the current state is the voltage mode and the current button is pressed the next State will be the current mode. For this purpose in each State of the state machine should be the same structure of event with the same events.

    My problem is that the Vi does not work properly when I have several structures with the same case of event event. There are some possibly to do and how? Or is impossible to have several events? I read a few posts, but I can't find solutions.

    Any help is appreciated.

    Thank you very much.

    In general, you should have 1 structure of the event in your VI.  In your state machine, the structure of the event should be in "pending" status  So you will probably start in the State of the initialization and then spend idling.  Then, the user presses the present button.  If your state machine should then, go to the current state and then return to Idle.

  • Several channels with different frequencies

    Hello

    I use card NI USB-6221.

    The C API using, I need to generate 6 digital output channels, with frequencies of diffrenet and Heavy duty.

    To be more precise, the 2 are totally identical, but I need them to be reversed, and the other 4 are similar to another, but should be shifted in time (I.e. There is a delay between each of the channels).

    I used the 2 channels of CO that the USB-6221 takes charge for the first two signals, and it works very well (the two signals are synchronized and are reversed).

    Now I need an additional 4 channels for the other vague square.

    I saw an articale NOR by JohnP web site with the title:

    Generate multiple channels of digital output with different frequencies and Heavy Duty

    The following example shows how to create and generate a digital with the non-regeneration wave form so that you can change the frequency and the duty cycle on the fly with the M Series DAQ hardware X.  The example uses output digital rather than counters to achieve this, so if you need more output than the available counters, it would be a good option (Note: on the materials of the M series an external sample clock must be provided, this may be caused by one of the counters if you want).

    that seems to be exactly what I need, but the examples are for LabView which I did not.

    Can someone explain how to do this with the C functions?

    Best regards

    Danny.

    Hey Danny,

    The important thing to note is that you can clock of arbitrary digital waveform (up to 1 MHz on the 6221).  The real data acquisition programming is pretty easy once you have the waveform.  My Example LV used LabVIEW Base generating function VIand then converted to a digital waveform to generate the signal from each channel.

    The functions of LV helped tremendously with to achieve the waveforms to be updated on the fly (the basic function generator keeps track of phase for you).

    If you do not need to be updated on the fly, then the construction of the waveform in C should not be too bad.  For example:

    P0.0 [1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0] * 1

    P0.1 [0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0] * 2

    P0.2 [0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1] * 4

    P0.3 [1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1] * 8

    [9 9 9 9 9 3 3 3 3 3 6 6 6 6 6 12 12 12 12 12]

    The table above U8 would give you 4 output waveform of 50% duty cycle at Fs/20, shifted 90 degrees to eachother.  The lines would be p0.0 by p0.3 (the bit rate of the U8 corresponds to what line goes high).

    Best regards

  • Several buttons to toggle (for audio playback/stop)?

    Hello

    I was able to create a toggle button play/stop for a song with the following code

    (I have 2 buttons for a symbol of video layer and then import an mp3 file):

    toggle_btn. Stop();

    var played: Boolean = false;

    var mySound:Sound = new MySound();
    var myChannel:SoundChannel = new SoundChannel();
    toggle_btn.addEventListener (MouseEvent.Click, togglePlay);

    function togglePlay(event:MouseEvent):void {}
    (! played)? played = true: played = false;
    (played)? myChannel = mySound.play ():SoundMixer.stopAll();

    (played)? toggle_btn.gotoAndStop (2):toggle_btn.gotoAndStop (1);

    myChannel.addEventListener (Event.SOUND_COMPLETE, soundCompleted);
    }
    function soundCompleted(event:Event):void {}
    played = false
    toggle_btn.gotoAndStop (1)
    }

    The problem is, I can't understand how to do several buttons to toggle different songs in a single file. Thanks for the help!

    I use Adobe Flash Pro CC 2015 and ActionScript 3.0

    Change the sound: mySound = new theSong();

  • How can I run script jsx button with photoshop, I been tried more (HTML 5)

    How can I run script jsx button with photoshop, I tried, but I get no results please someone help me in this issue that I can continue my extension and gives me the good code that I can use it.

    Thank you very much

    In the index.html file, you will need to create a button and call the function when button by clicking on:

    "button" id ="button" onclick = "getDucumentFormatFun ()" > name of the Document:

    In the js file you must set the getDucumentFormatFun() function:

    function getDucumentFormatFun() {}

    fileFormat var = "get_fileFormat()";

    evalScript (fileFormat, fileFormatCallback);

    }

    define the callback function: fileFormatCallback

    function fileFormatCallback (res) {}

    Alert ("the name of the active document is:" + res);

    }

    In jsx file:

    get_fileFormat = fileFormatFun;

    function fileFormatFun()

    {

    Return app.activeDocument.name;

    }

  • Several buttons and an EventListener

    Hello world

    I put 10 buttons on my stage, name it "b1", "b2", "b3", "b10".

    All of these buttons should use the same function.

    Is it possible to dynamically?

    var r: Array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].

    for (var i = 0; i <.) Length; i ++) {}

    button = "b" + a [i];

    This [button] .addEventListener (MouseEvent.CLICK, onClick_b);

    function onClick_b(pEvt: Event): void {}

    my_mc. Play();

    }

    }

    Only the button 'b10' play my function.

    Someone at - it an idea how all other buttons serve this function?

    Thank you! C.

    If you want to use the table 'a' then your for loop just needs to be:

    var a: Array = new Array (bone, btwo, bthree);

    for (var i in a) {}

    a [i] .addEventListener (MouseEvent.Click, onClick_b);

    }

    The line key = 'b' + a [i]; has several problems. You not report 'button' to be a variable, then you will probably get an error. Using the button is not necessary in all cases. The part, "b" + a [i]; feel bad a letter b for each of the elements of the array. The problem with that is that you end up with a string. When you try to add an event listener to this string, you will get another error.

    The names of instances of objects on the stage are not strings, they are values of property and so they are not presented with quotes around them. A button instance on the stage with an os name, or adeux, just shows that, OS, not "BONES", in the code.

Maybe you are looking for