Help with Action script 2.0 Please

Hello
I'm new to actionscript and I really could with little help please. I'm loading external movie clips in two different containers depending on which button is clicked. Sometimes, there may be two conatiners attached to a buuton click, while the other buttons may only need to download a video clip. Here is the action script, I've been using:

Button1.onPress = function () {}
_root.createEmptyMovieClip ("container", 1);
_root.createEmptyMovieClip ("Container1", 2);
unloadMovie ("container1");
loadMovie ("scene2.swf", "container");
loadMovie ("scene5.swf", "Container1");

Container._x = 50;
Container._y = 110;
container1._x = 170;
container1._y = 5;
}
Button2.onPress = function () {}
loadMovie ("scene6.swf", "container");
unloadMovie ("container1");
Container._x = 50;
Container._y = 110;
}

It is responsible for the movies, but I have to press first button both work. Ideally I need to be able to call a movieclip at any time. Can someone tell me where I'm wrong?

Try to move these lines outside the function of the button:

_root.createEmptyMovieClip ("container", 1);
_root.createEmptyMovieClip ("Container1", 2);

You can use 'this' instead of '_root'... that will save any problem if you never move it to some other films. In addition, move the x / y assignments right under these lines since they relate to them directly.

Tags: Adobe Animate

Similar Questions

  • Help with action scripts

    I have developed a website and I have problems with something that is probably very simple. I created several clips that expand and contract as you hover over them. I wanted to make a function/method when the user clicks, it leads to another scene from this movie. Here is the action script I use:

    {We (Release)}
    gotoAndPlay ("scene 9");
    }

    Unfortunately, this does not work. I thought that maybe the method one (release) would not work on these video clips based on the action script that I was already using to expand/collapse the boxes, but the following code works fine:

    {We (Release)}
    getURL ("home.html");
    }

    I'm puzzled. Can anyone offer a suggestion as to what I should do? Here is the web address of the page, I'm working, that's the movie I'm having a problem with. AndrewJW.com. the first picture on the left next to the photograph of Word links to another page in the site. The image of Pearl next to this ring is one who will not advance to the next scene in the film.

    Thanks for any input.

    Andrew

    Jeckyl >

    UH... Okay I admit my mistake in the 2nd script.
    _root.gotoAndPlay () takes a single argument,
    _root.gotoAndPlay ("scene 9", 1); doesn't work.
    Thanks for reminding me

    in fact this will make me confuse awhile,
    indicator of code in flash.

    for gotoAndPlay,.
    gotoAndPlay ( frame);
    gotoAndPlay ( scene, frame);

    for MovieClip.gotoAndPlay,.
    MovieClip.gotoAndPlay ( framework);

    Thus, gotoAndPlay can accept 2 arguments only when use without 'something dot' forwards.

    If Andrew script is attached to an instance of the button symbol, we use

    {We (Release)}
    gotoAndPlay ("scene 9", 1);
    }

    As Andrew attach the script to an instance of movieclip, it can use:

    {We (Release)}
    gotoAndPlay ("scene 9");
    }

    where the label to be the 1st image of 'Scene 9' even with the stage name.

    I'm right Jeckyl?

    I heard a lot of people said 'scene' + 'script '=' buggy', but some times that I get it 'works '. What is your opinion?

  • Help with a script basis VM please?

    Dear all

    Also useful are you always wondered if you could help me with my small (very basic) script. All I am trying to do is get the VMName, IPAddress and guestname issued in a CSV file. Easy, I hear say you - true Yes, but the problem I am having is my script outputs the VMname and comments Name OK, but 'IP address' is constantly as 'System.String [] '. When I tested in a console session "variable", I used seems good info of output.

    $outputFile = "C:\test\Results.csv".

    $myCol = @)

    $vms = get - VM

    Foreach ($vm to $vms)

    {

    $myObj = "" | Select the virtual machine, IPAddress, invited

    $myObj.VM = $VM. Name

    $myObj.IPaddress = ($vm.guest.IPAddress)

    $myObj.Guest = ($vm.guest.OSFullName)

    $myCol += $myObj

    }

    $myCol | Export-Csv

    Invoke-Item $outputFile

    Yet once all help you will place in highest greetings

    Thanks in advance

    Munster

    This can be done easier and faster:

    $outputFile = 'C:\test\Results.csv'
    
    Get-VM | Foreach-Object {
      $myObj = "" | Select VM, IPAddress, Guest
      $myObj.VM = $_.Name
      $myObj.IPaddress = "$($_.Guest.IPAddress)"
      $myObj.Guest = $_.Guest.OSFullName
      $myObj
    } | Export-Csv -Path $outputfile -NoTypeInformation
    Invoke-Item $outputFile
    

    Best regards, Robert

  • Transparency with action script

    I have a swf file and I want to give a transparent background on the stage. I understand that it is possible to give it transparency through the HTML publish setting using the ' transparent windowless "property.
    However, I wanted to know if there is an actionscript property to give the same effect of transparency to the scene. like the opactiy or something (sorry, that I may be wrong)

    The thing is I have an external preloader that loads the swf content and when it is loaded, the stadium loses its transparency.
    any help please with action script on transparency?

    As mentioned, that there is no bottom in a loaded SWF file. Unless you EXPLICITLY put a layer in your document with a background on the subject, it is transparent. You can load SWF 500 inside another, you will never get a background of any of them.

    The sole purpose of context is if the original HTML wrapper was not established transparent windowless.

    Your problem is elsewhere, trust us. Look for something, a background of drawing in one of your movies, because something is without doubt.

  • Help: button action script 3

    IM new begineer, using flash cs4 with script action 3

    I have a button with action script code

    " submit_btn. addEventListener (MouseEvent.CLICK, btnDown); "

    but it gave me following warning msg...

    "WARNING: Actions on the button or MovieClip instances are not supported in ActionScript 3.0." All the scripts on the instances of the object will be ignored. »

    Please advise... Thank you

    "Click on" no longer works in the action script 3.0?

    You can not put the code on objects as you can do in AS1/AS2.  All code must be in the timeline or in separate .as files.  AS3 doesn't support not AS1/AS2 'on' code.

  • Need help with a script (o - o8) *, see the Virgin if there is no

    Hi all what I need help with a script I can't find an example.

    I'm trying to subtract 2 numbers and then multiply this product. (o o8) * one but I just want to do the calculations if all fields have the numbers IE field o, o8 of field and field one.

    Thank you in advance. I was stuck on this days searching the Internet.

    Assuming you want to affect the outcome of this calculation in another text field, use this code as a custom field calculation script:

    var o = this.getField("o").valueAsString;
    var o8 = this.getField("o8").valueAsString;
    var a = this.getField("a").valueAsString;
    if (o!="" && o8!="" && a!="") event.value = (Number(o)-Number(o8))*Number(a);
    else event.value = "";
    
  • Interpolation with action script + / from a fixed location

    I know the basics of the interpolation with action script, but I have a picture located in the center of the stage at x = 50.  With a click, I, move this photo - 10 x from this position if it will end the interpolation at 40.  A different button, I would make the oppositie, + 10 x to its current position and if it was at 40 you come back at the beginning and if it was at the beginning, it would be at age 60.

    Thank you

    You can use:

    prevTX.onRelease = function () {}

    this.useHandCursor = false;

    nextTX._visible = true;
    prevTX.enabled = false;
    nextTX.enabled = false;

    addition of the var: number = 100 + thTX._x;
    var myTween1:Tween = new Tween (thTX, "_x", Strong.easeOut, thTX._x, addition, 3, true);
    myTween1.onMotionFinished = function() {}

    prevTX.useHandCursor = true;
    prevTX.enabled = true;
    nextTX.enabled = true;

    }

    }

  • Fill the stage with Action Script

    Hello

    I'm new to flash and Action script. I would like to know how I could fill (instead of copy and paste) the scene with a small button e.g. 10 x 10 px. Let me explain what I'm trying to do here. It's a simple game that includes 4000 buttons, 50 lines of 80 buttons. Each button has States, not available, available and in the process. Visitors come to the page and start clicking, wins the one who has the most clicks.

    So instead of doing this with the painful copy and paste, to give the button a unique id, I was wondering if there is a way to do this with action script, generating 50 lines, 80 buttons per line, and each of them giving an id with j ++ or something.

    Thank you very much and sorry for my English.

    Of course, no problem actually. I would use two pieces of code. The first would be a
    class, which extends MovieClip and attached to your button element in the library.
    Then a little to the loop on the main timeline to attach buttons to the
    step and you're all set.

    For the class:

    class com.yourdomain.Sample extends MovieClip
    {
    var myID:Number;

    function Sample() {}

    public function set id(newID:Number):Void
    {
    myID = newID;
    this.onRelease = function() {}
    trace (this.) MyID);
    }
    }

    }

    Of course, you will need to change the com.yourdomain to your own class path.
    Then just put your clip in the library to export for ActionScript and set
    class: com.yourdomain.Sample

    In the main timeline then write a function createGrid bit as follows:

    function buildGrid (tot, sx, sy, pc, cs, rs) {}
    var startX = sx;
    var currX = startX;
    var startY = sy;
    perCol var = pc;
    var colSpace = cs;
    var rowSpace = rs;
    Use tot + 1 because we are not going to go 1-0 in the loop below
    var total = tot + 1;

    for (var i = 1; i)< total;="">
    Clip var = this.attachMovie ("btn", "btn" I, I + 10, {_x:currX,)
    _y:startY});
    clip.ID = i;
    currX += colSpace;
    If (I % perCol == 0) {}
    startY += rowSpace;
    currX = startX;
    }
    }
    }

    And call it:

    buildGrid (100, 20, 20, 10, 12, 12);

    This will make a grid of 100 occurrences of the element named "btn" (one with)
    your attached class), from 20,20 with 10 per line and 12 pixels
    between the centers... When you click on one any of them they will trace their
    appropriate index 1-100

    HTH

    --
    Dave-
    Developer leader
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.Adobe.com/communities/experts/

  • Need help with a script customized for processing in Photoshop CS4 of images in batches. Really grateful for the help thereby.

    Hi people.

    So I have a boatload of pictures that I have to deal with as I'm moving off Ebay and open my own online store and the images that I have on Ebay, although excellent quality are not square, and unfortunately, the model that I use in Wordpress requires square photos.

    Basically, what I need is a script that I can use in batch mode, which will focus on the size of the image and change the canvas size to be square corresponding to the current long image side. Resize the image to 1600 square pixels and finally save for web in JPEG quality 60.

    Normally I would muddle my way through this trying to teach myself but I already do so much with this new project that I can't afford to pay developers for help that I would really appreciate if someone could help me with this script. I use Photoshop CS4 if it made a difference.

    Thanks much for any help you can offer.

    See you soon,.

    J

    A simple gesture can do that. What you need to do is that the action of lot.   With the help of Photoshop Image Processor script.  The Action is a two-step

    N ° 1). File menu > automate > fit Image.  In the dialog box Image Fit you assign Width and Height 1600 pixels.

    Step 2.) Menu Image > canvas size.  In the canvas size dialog box, you assign Width and Height 1600 Pixels.

    Record the action in some action with a name like 1600PxSquare

    Then use the file menu to Photoshop > Scripts > image processor. In the dialog to the Image Processor script. Select your image source folder. Set where you want your jpeg images. Set it to save jpeg files quality 6.  Set it to include your 1600PxSquare action.

    Step adjustment image resize your image to fit in a 1600 x 1600 pixels are while keeping image proportions of images. Portrait image will be high 1600px and landscape image will be 1600px wide.  The step size canvas will add the canvas to make the place of the image.  Portraits will have a border on the left and right images of landscape will be confined to the op and downs.

  • Need help with transformation Script

    Well I'm back for the 2nd time today. I would like to thank all those who helped me with my last issue. But now I have another question that I'm developing. Craig & Dan here me helped with 2 separate sending email responders based on questions in the form.

    You can view the form on this link:
    http://mswebsol.com/gaslockguarantee/creditapplication.cfm

    The problem I have right now, is that I don't get the results that I'm looking. Basically lets say you choose Yes to all 4 questions but on the 5th issue, you click on no. Well as it is now the script sends the answer by e-mail indicating your accepted. But what I'm trying to make, is that if you choose not to one of the questions you will automatically get an e-mail response that says you are not admitted.

    If I choose not to question, I'll get the answer correct email which is "your not accepted" to make it work for the first question. But if you choose Yes to the first question and no to the 2nd or any other question you will get the wrong answer that says "you are accepted."

    Here is the code

    < Cfif StructKeyExists(form,"Q1") >
    < cfif form. Q1 is 'Yes' >
    < intrusion via cfmail > accepting... < / intrusion via cfmail >
    < cfelse >
    < intrusion via cfmail > not accepting... < / intrusion via cfmail >
    < / cfif >

    < cfelseif StructKeyExists (form, "Q2") >
    < cfif form. Q2 eq 'Yes' >
    < intrusion via cfmail > accepting... < / intrusion via cfmail >
    < cfelse >
    < intrusion via cfmail > not accepting... < / intrusion via cfmail >
    < / cfif >

    < cfelseif StructKeyExists (form, "Q3") >
    < cfif form. Q3 eq 'Yes' >
    < intrusion via cfmail > accepting... < / intrusion via cfmail >
    < cfelse >
    < intrusion via cfmail > not accepting... < / intrusion via cfmail >
    < / cfif >

    < cfelseif StructKeyExists (form, "Q4") >
    < cfif form. Q4 eq 'Yes' >
    < intrusion via cfmail > accepting... < / intrusion via cfmail >
    < cfelse >
    < intrusion via cfmail > not accepting... < / intrusion via cfmail >
    < / cfif >

    < cfelseif StructKeyExists (form, "Q5") >
    < cfif form. Q5 eq 'Yes' >
    < intrusion via cfmail > accepting... < / intrusion via cfmail >
    < cfelse >
    < intrusion via cfmail > not accepting... < / intrusion via cfmail >
    < / cfif >
    < / cfif >

    Any help would be greatly appreciated!

    Thanks to you all

    Derek Bess
    @ Coldfusion newbie

    If I understand you well, all your if/else logic boils down to a simple:
    (1) one of the answers is "No" - send 'rejected' by email
    (2) all the answers are "Yes" - email "accepted."

    I suggest you cfparam all default = 'no' on your action and answers
    the page, so that you don't have to keep control of structkeyexists:


    ...

    After that, all you need is:


    .. .send 'rejected' code email here...

    .. .send 'admitted' code email here...

    HTH

    Azadi Saryev
    SABAI - Dee.com
    http://www.SABAI-Dee.com/

  • Problem of Windows with Action Scripts run from a Panel

    I created a panel that has shortcuts for Menu items and tools. I have also two buttons on my slab that run scripts that were created with Actions. I tested these two scripts with the ExtendScript Toolkit for both Mac and windows.

    Both scripts do not run on some computers in the window, but they do on others. It seems that the problem more with 7 of the window then in any other operating system, but it is not universal.

    I am at a loss on how to get hurt this problem. Machine window 7, I'm testing on runs the script without any problems, but some users of my panels have the problem above.

    Any ideas?

    Thanks in advance - Sam

    Action handler code looks like it's a step to play a shadow of action which lies in a defined action named SmileixPix.

    If you added that action shadow action value saved SmilePix the action defined and distributed the action defined in the package.

    If users have an action set SmilePix and you loaded the update action defined as a part of you install. Users can end up with two responsible actions named sets SmilePix one containing the action of the shadow and the other without the Sdade action.  I don't know what would happen if your panels has been used and there was a prior action set SmilePix which is not the action of the shadow.  Make sure that defective computers do not list Action Games named SmilePix twon

  • Help with a script

    Hi all

    I've been loving learning PowerCLI.

    I have problems, adding information to a script I had help with.  I have problems with the eastern line,

    Add-Member - InputObject $reportedvm - MemberType noteProperty-name GuestOs - value $VM. Guest.OSFullName

    I'll add the entire script bellows.  If someone could explain to me what I am doing wrong.  I get just white that colum in my CSV.  I guess that the $VM variable does not have property info I'm looking for.  I don't know if I have to do a join or something else to get this info.

    Here's the script as a whole.

    $reportedvms = New-Object System.Collections.ArrayList
    $vms = get-view - viewtype virtualmachine. Tri-objet-property {$_.} Config.Hardware.Device |  where {$_-is [VMware.Vim.VirtualEthernetCard]} |  Measure-object | {Select - ExpandProperty County}-descending
    {foreach ($vm to $vms)
    $reportedvm = new-Object PSObject
    Add-Member - Inputobject $reportedvm - MemberType noteProperty-Guest name-value $vm. Name
    Add-Member - InputObject $reportedvm - MemberType noteProperty-name-value of $($vm.) UUID Config.Uuid)
    Add-Member - InputObject $reportedvm - MemberType noteProperty-name GuestOs - value $VM. Guest.OSFullName
    Add-Member - InputObject $reportedvm - MemberType noteProperty-name ToolsVersion-value $VM. Config.Tools.ToolsVersion
    Add-Member - InputObject $reportedvm - MemberType noteProperty-name ToolsUpdate - value $VM. Guest.ToolsStatus
    $networkcards = $vm.guest.net
    $i = 0
    {foreach ($ntwkcard to $networkcards)
    Add-Member - InputObject $reportedvm - MemberType NoteProperty-Name "card$ {i}." Network"- value $ntwkcard.Network
    Add-Member - InputObject $reportedvm - MemberType NoteProperty-Name "card$ {i}." IpAddress"- value of $($ntwkcard.) IpAddress |? {$_ - like "*."} * »})
    $i ++
    }
    $reportedvms.add ($reportedvm) | Out-Null
    }
    $reportedvms | Export-Csv C:\temp\vm_nic_report.csv

    Try

    $VM. Guest.guestFullName

    instead.

    You're recovery VirtualMachine objects.

  • help with resizing script

    I found an online script that turns pictures into a square (by increasing the size of the canvas on the short side to match the length of the long side) which is awesome, but I would like to make an extra step and I have no experience with script so I hope someone can help.

    now that my images are square, I want to put a maximum of 2500 x 2500 px size, I found scripts to set a resolution of a specific size, but I want to make sure to avoid is upsampling, so I want just any image is greater than 2500 x 2500 px down sample to 2500 x 2500 px

    all information on the code for this would be much appreciated.

    When I'm at the machine with the script that I currently use will be to paste it here in the meantime if you know something about the scaling of the images down, but preventing their intensification I could probably chimpanzee with the code I have and make it work.

    Something like this might work, you can change the ResampleMethod, however:

    top-down images of squares more 2500px up to 2500px.

    2012, use it at your own risk.

    #target photoshop

    If (app.documents.length > 0) {}

    myDocument = app.activeDocument;

    value of pixels;

    var originalRulerUnits = app.preferences.rulerUnits;

    app.preferences.rulerUnits = Units.PIXELS;

    get the dimensions;

    var theWidth = myDocument.width;

    var theHeight = myDocument.height;

    If (theWidth == theHeight) {}

    If {(theWidth > 2500)

    myDocument.resizeImage (2500, 2500, myDocument.resolution, ResampleMethod.BICUBICSHARPER)

    };

    }

    else {alert ('not square')};

    reset;

    app.preferences.rulerUnits = originalRulerUnits;

    };

  • Need help with as2 as3 conversion. Please, I beg you.

    Could someone help me to convert as2 as3, please?

    Source code:

    _root.magnet = 500;
    _root.magic = 10;

    and

    onClipEvent (load)
    {
        homex = this._x;
        homey = this._y;
        forcex = 1;
        forcey = 1;
    }
    onClipEvent (enterFrame)
    {
        x0 = this._x;
        y0 = this._y;
        x1 = this._xmouse;
        y1 = this._ymouse;
        distancex = x1 - x0;
        distancey = y1 - y0;
        distance = Math.sqrt(distancex * distancex + distancey * distancey);
        powerx = this._x - distancex / distance * _root.magnet / distance;
        powery = this._y - distancey / distance * _root.magnet / distance;
        forcex = (forcex + (homex - x0) / 2) / _root.magic;
        forcey = (forcey + (homey - y0) / 2) / _root.magic;
        this._x = powerx + forcex;
        this._y = powery + forcey;
    }

    I am a newbie in flash so if anyone can help with this would be great.

    I really need to be done please help me.

    MovieClip(root).magnet = 500;MovieClip(root).magic = 10;
    

    and

    var homex:Number = yourmc.x;var homey:Number = yourmc.y;var forcex:Number = 1;var forcey:Number = 1;
    
    yourmc.addEventListener(Event.ENTER_FRAME, loopF);
    
    function loopF(e:Event){    var x0:Number = e.currentTarget.x;    var y0:Number = e.currentTarget.y;    var x1:Number = e.currentTarget.mouseX;    var y1:Number = e.currentTarget.mouseY;    var distancex:Number = x1 - x0;    var distancey:Number = y1 - y0;    var distance:Number = Math.sqrt(distancex * distancex + distancey * distancey);    var powerx:Number = e.currentTarget.x - distancex / distance * MovieClip(root).magnet/distance;    var powery:Number = e.currentTarget.y - distancey / distance * MovieClip(root).magnet/distance;    forcex = (forcex + (homex - x0) / 2) /MovieClip(root).magic;    forcey = (forcey + (homey - y0) / 2) / MovieClip(root).magic;    e.currentTarget.x = powerx + forcex;    e.currentTarget.y = powery + forcey;}
    
  • Can someone help with the scripts on this file?

    Hi, I hope someone with a bigger brain can help me here.

    I have an existing Flash CS3 file that makes up the result to http://www.infusion-set.com/Flash/eLearning/Inset30/inset30_eguide.html .

    The customer asked if I could add an extra tab at the top after that 'group' called 'Contact us' with link to an additional page. The design was done in ActionScript 2 with references to XML files for dynamic content because it has been done in other languages.

    I modified the XML file with the correct references to a new page and a .swf file that accompanies it to play in the field of animation.

    I tried a .fla version where I duplicated one of the existing tabs script, changed the XML references and changed the variables if necessary to "con or"Con"(which is to reach us). Unfortunately, he made the menu tab go completely off the page and was patently false in some way.

    Can someone give me a clue as to what to change here on the original file that I am a novice with ActionScripts, so ask me.

    For reference, I have attached the HTML files with scripts of original file and my incorrect version. The chronology is 103 images with the scripts placed in frame 1 and 102

    Thank you.

    Garry

    The buttons are all created using the same library object (but MC), except for the code you have in the revised file does not call on it for the con button.

    You calling on something with a name of 'con' link, which tells me that a quick check is not - then it is undefined in the code when you try to use it.  I found this by using trace (newConBut._x); After its _x value was assigned, as I said, you should try.   So the first thing you want to do is to change the following line from...

    var newConBut = _root.attachMovie ("con", "conbut", _root.getNextHighestDepth ());

    TO

    var newConBut = _root.attachMovie ("but", "conbut", _root.getNextHighestDepth ());

    so that it uses the but MC who is used to this end in the library.  So, you want to correct the assignment _x of the buttons and I think that you had previously...

    newConBut._x = 650 - newConBut._width;
    newRecBut._x = newConBut._x - newRecBut._width;

    Here is a picture of what these changes (note, without the XML file, I had to finagle things just to work, then the labels of biutton are not what they will be)...

Maybe you are looking for

  • iPhone 6 touch id cannot be added after the upgrade ios 9.3.5

    My iPhone6 more ' Touch ID ceased to operate after the sound ' iOS to 9.3.5. This never happened with the previous iOS updates. Soft reboot (button home + power until the display of the apple logo) didn't work. Turn off the two "use Touch ID" for Unl

  • Problems of WiFi and windows 8

    Could not get wifi to work after the upgrade to Windows 8.  I installed the latest drivers and it still does not work. Does anyone have a solution? I have an Acer Aspire V3-551-7655 and improved 64-bit Win 7 to 64 - bit Win 8.

  • Downgrade to Windows XP Pro Sp2, x 86 Vista Home Premium 64-bit

    I tried, but I have not simply can't work with Windows Vista. I have to downgrade to Windows XP. I have a new laptop HP HDX X18t with a Core 2 Duo T9600 2.80 GHz processor (with the last correspondent chipset Intel?)4 GB ram ddr3Hewlett-Packard Bios

  • You can turn the photo in Windows Photo Viewer

    Judging by the large number of comments, rotating an image in Photo Viewer seems to be a common problem and I do not understand why. Have spent a lot of time to wade in these messages, and am even more close to an answer. I followed the instructions

  • Different login after connecting?

    How do I solve this problem