Help with simple script
I was wondering if someone could help me with a simple bit of action script 3. I need to make a movie clip (single_mc) disappear when the user clicks on the mouse (stop_btn). Here’s what I have so far.
function setProperty(event:MouseEvent):void
single_mc.alpha=0;
stop_btn.addEventListener(MouseEvent.CLICK, setProperty);
Also I was wonder if you could recommend an Action script 3 book for me. I would like one that is not a training book, but has situations and then the script written out. For example: I click a button and a movie symbol disappears from the stage. I am a graphic artist, that from time to time, needs simple interaction in flash, but cant justify the time to learn the script.
Thanks for your time
use the snippets panel to help with you with sample code for basic tasks.
function setProperty(event:MouseEvent):void
single_mc.visible=false;
stop_btn.addEventListener(MouseEvent.CLICK, setProperty);
Similar Messages
-
Need help with simple Quicktime 8 Batch Save As Mov script
I'm new with AppleScript and would like to create a simple script that will take MEPG, AVI, and other video files and wrap them as an MOV file. I thought I used to have a script that would allow me to drop multiple files or folders onto it and it would batch "save as" to the MOV container. Any help is appreciated!
Thanks,
EricHi,
See these:
http://stackoverflow.com/questions/11690142/how-to-call-a-vbscript-from-a-batch-file-without-opening-an-additional-command-p
http://stackoverflow.com/questions/11899730/running-vbscript-from-batch-file
Don't retire TechNet! -
(Don't give up yet - 13,225+ strong and growing) -
Need help with simple XML validation
I am new to Spry and need some help creating a simple
validation. There is a form field which must not contain a value
already in the database. I have a script which accepts a parameter
and returns a boolean result. Here is the XML:
<samples>
<sample>
<ISFOUND>0</ISFOUND>
</sample>
</samples>
1. How do I call this script when the form field changes and
pass the form value as the parameter?
2. How do I check the returned value in the XML and throw an
error if true?
I appreciate any help with this. Please let me know if there
is a better way to achieve the same result.
Thanks,
RichI enabled the call to the XML response. However, I am having
trouble identifying when the call is complete so I can parse the
result. How do I run my check after the data load and display the
proper message? -
I need help with this script please ASAP
So I need this to work properly, but when ran and the correct answer is chosen the app quits but when the wrong answer is chosen the app goes on to the next question. I need help with this ASAP, it is due tommorow. Thank you so much for the help if you can.
The script (Sorry if it's a bit long):
#------------Startup-------------
display dialog "Social Studies Exchange Trviva Game by Justin Parzik" buttons {"Take the Quiz", "Cyaaaa"} default button 1
set Lolz to (button returned of the result)
if Lolz is "Cyaaaa" then
killapp()
else if Lolz is "Take the Quiz" then
do shell script "say -v samantha Ok starting in 3…2…1…GO!"
#------------Question 1-----------
display dialog "Around age 11, many boys left their fathers to become…" buttons {"Scholars", "Warriors", "Apprentices"}
set A1 to (button returned of the result)
if A1 is "Apprentices" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#----------Question 2--------
display dialog "Most children were taught
to read so that they could understand the…" buttons {"Music of Mozart", "Bible", "art of cooking"}
set A2 to (button returned of the result)
if A2 is "Bible" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#------------Question 3---------
display dialog "In the 1730s and 1740s, a religious movement called the_______swept through the colonies." buttons {"Glorius Revolution", "Great Awakening", "The Enlightenment"}
set A3 to (button returned of the result)
if A3 is "Great Awakening" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#-----------Question 4--------
display dialog "_______ was
a famous American Enlightenment figure." buttons {"Ben Franklin", "George Washington", "Jesus"}
set A4 to (button returned of the result)
if A4 is "Ben Franklin" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#----------Question 5-------
display dialog "______ ownership gave colonists political rights as well as prosperity." buttons {"Land", "Dog", "Slave"}
set A5 to (button returned of the result)
if A5 is "Land" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#---------Question 6--------
display dialog "The first step toward guaranteeing these rights came in 1215. That
year, a group of English noblemen forced King John to accept the…" buttons {"Declaration of Independence", "Magna Carta", "Constitution"}
set A6 to (button returned of the result)
if A6 is "Magna Carta" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#----------Question 7--------
display dialog "England's cheif lawmaking body was" buttons {"the Senate", "Parliament", "King George"}
set A7 to (button returned of the result)
if A7 is "Parliament" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#--------Question 8-----
display dialog "Pariliament decided to overthrow _______ for not respecting their rights" buttons {"King James II", "King George", "King Elizabeth"}
set A8 to (button returned of the result)
if A8 is "King James II" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#--------Question 9------
display dialog "Parliament named ___ and ___ as England's new monarchs in something called ____." buttons {"William/Mary/Glorius Revolution", "Adam/Eve/Great Awakening", "Johhny/Mr.Laphalm/Burning of the hand ceremony"}
set A9 to (button returned of the result)
if A9 is "William/Mary/Glorius Revolution" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#---------Question 10-----
display dialog "After accepting the throne William and Mary agreed in 1689 to uphold the English Bill of _____." buttons {"Money", "Colonies", "Rights"}
set A10 to (button returned of the result)
if A10 is "Rights" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#---------Question 11------
display dialog "By the late 1600s French explorers had claimed the ___ River Valey" buttons {"Mississippi", "Ohio", "Hudson"}
set A11 to (button returned of the result)
if A11 is "Ohio" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#------Question 12---------
display dialog "______ was sent to ask the French to leave 'English Land'." buttons {"Johhny Tremain", "George Washington", "Paul Revere"}
set A12 to (button returned of the result)
if A12 is "George Washington" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#---------Question 13-------
display dialog "_____ proposed the Albany Plan of Union" buttons {"George Washingon", "Ben Franklin", "John Hancock"}
set A13 to (button returned of the result)
if A13 is "Ben Franklin" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#--------Question 14------
display dialog "The __________ declared that England owned all of North America east of the Mississippi" buttons {"Proclomation of England", "Treaty of Paris", "Pontiac Treaty"}
set A14 to (button returned of the result)
if A14 is "" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#-------Question 15-------
display dialog "Braddock was sent to New England so he could ______" buttons {"Command an attack against French", "Scalp the French", "Kill the colonists"}
set A15 to (button returned of the result)
if A15 is "Command an attack against French" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#------TheLolQuestion-----
display dialog "____ is the name of the teacher who runs this class." buttons {"Mr.White", "Mr.John", "Paul Revere"} default button 1
set LOOL to (button returned of the result)
if LOOL is "Mr.White" then
do shell script "say -v samantha Congratulations…you…have…common…sense"
else
do shell script "say -v alex Do…you…have…eyes?"
#------END------
display dialog "I hope you enjoyed the quiz!" buttons {"I did!", "It was horrible"}
set endmenu to (button returned of the result)
if endmenu is "I did!" then
do shell script "say -v samantha Your awesome"
else
do shell script "say -v alex Go outside and run a lap"
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end ifUse code such as:
display dialog "Around age 11, many boys left their fathers to become…" buttons {"Scholars", "Warriors", "Apprentices"}
set A1 to (button returned of the result)
if A1 is "Apprentices" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
return
end if
#----------Question 2--------
display dialog "Most children were taught to read so that they could understand the…" buttons {"Music of Mozart", "Bible", "art of cooking"}
set A2 to (button returned of the result)
if A2 is "Bible" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
return
end if
(90444) -
Hi,
I found this Apple script online and here's how it works:
tell application "QuickTime Player"
activate
try
if not (exists document 1) then display dialog "Please open a QuickTime movie." buttons {"Cancel"} default button 1 with icon 1
set thefile to (choose file name)
save document 1 in thefile
close document 1
end try
end tell
+I run the Apple script+
*1. It prompts me to open a movie file in Quicktime*
+I open a movie in Quicktime+
*2. It prompts me for an name and directory to save the new file in*
+I enter a name and directory+
*3. It saves a new reference movie in said directory with said name*
This is useful if I want to customize every file, but unfortunately, I just want to mass create reference movies for a whole bunch of files.
What I am looking for is for an Apple script that is a drag and drop application, so I can drop say 100 movie files or so, and have the Apple script create reference movie files with the same name and in the same directory automatically with no prompts.
Since I am unfamiliar with Apple script I was wondering if someone would be able to edit my existing script to do what I want.
Thanks so much for your help!Use Automator. It's great for repetitious tasks (like the one you've described), and it's very user-friendly. Open Automator, create a new workflow that executes the action you want, and you can apply that action to the resources you wish to edit.
Good resource here:
http://bit.ly/ -
I found a script online that turns my images into a square (by extending the canvas size of the short side to match the length of the long side) which is awesome, but I would like to do an additional step and I have no scripting experience so hopefully someone can help.
now that my images are square I want to set a maximum dimension of 2500x2500 px, i have found scripts to set a resolution to a specific size but what I want to make sure I avoid is upsampling, so I just want any image larger than 2500x2500 px to down sample to 2500x2500 px
any knowledge on the code for this would be much appreciated.
When I am at the machine with the script I currently use I will paste it here in the meantime if you know something about scaling images down but preventing scaling them up I could probably chimp with the code I have and make it work.Photoshop shipts with a plug-in script that will do that for you. its found under menu File>Automate>Fit Image. Set both width and height to 2500 and check do not resize images that fit so your small square images will not be resized up in size. You could also just create an action that uses both scripts
step 1 menu File>Scripts>Make canvas Square.
setp 2 menu File>Automate>Fit Image. The 2500 x 2500 no upsize option settings will be recorded into the step and when the action is used its dialog will be bypassed and the recorded settings will ne used.
You can then batch the action using menu file>Automate>Batch or menu File>Scripts>Image Processor. -
Would anyone be willing to help me with a script? I need to Find the first table using "ERTStyle1" table style, convert it to text, change the text style to "Tabfix" paragraph style, then convert it back into a table using the table style "ERTStyle2" convert the top row to a header. It needs to repeat this process until there are no tables left using the "ERTStyle1" table style.
I think I could almost do this myself using VBScript, but I am relatively new to scripting, and to be honest, I am hoping I can use this script to jump start my knowledge of VB in Indesign.So all of this is just to set the column widths to the sizes pre-defined in a paragraph style, i.e., always the same?
I feel like I almost could do that in VB!
But in Javascript, all it needs is sth in the ilk of
var myWidths = [ 10, 50, 100, 50, 12 ]; // in whatever units you fancy
var myTable = app.activeDocument.stories[0].tables[0]; // (just grabbing some table)
for (i=0; i<myTable.columns.length; i++)
myTable.columns[i].width = myWidths[i % myWidths.length];
.. and the most interesting thing here (written from top of my head) is the "myWidths" lookup: it doesn't matter how many columns there are in this table, 'cause the widths array wraps around. (But you won't need this because you know all of your widths in advance.) -
Please help with simple Drag N Drop
I’m desperate and need some help with this simple drag
and drop. Here is the scenario…this animation is for a
kindergarten course. I have 6 different colored teddy bears on the
floor and the bears are to be placed on the middle shelf in the
room, in no particular order. I have the code in place to drag the
bears, and they return to their original location if dropped in the
wrong area. Everything works, except I can’t make the bears
stick to the target area. The target area has to be the same for
all 6 bears. Can someone help me out with this?
I have a feeling that the problem has something to do with my
instance names, but I have tried everything I can think of and
cannot get it to work. Is there some way I can post, send, or
attach my .fla file for someone to look at? I’m desperate.
PLEASE HELP!var startX3:Number;
var startY3:Number;
var counter3:Number=0;
vf_A.addEventListener(MouseEvent.MOUSE_DOWN, pickUp3);
vf_A.addEventListener(MouseEvent.MOUSE_UP, dropIt3);
vf_E.addEventListener(MouseEvent.MOUSE_DOWN, pickUp3);
vf_E.addEventListener(MouseEvent.MOUSE_UP, dropIt3);
vf_I.addEventListener(MouseEvent.MOUSE_DOWN, pickUp3);
vf_I.addEventListener(MouseEvent.MOUSE_UP, dropIt3);
vf_O.addEventListener(MouseEvent.MOUSE_DOWN, pickUp3);
vf_O.addEventListener(MouseEvent.MOUSE_UP, dropIt3);
vf_U.addEventListener(MouseEvent.MOUSE_DOWN, pickUp3);
vf_U.addEventListener(MouseEvent.MOUSE_UP, dropIt3);
function pickUp3(event:MouseEvent):void {
event.target.startDrag(true);
reply2_txt.text="";
event.target.parent.addChild(event.target);
startX2=event.target.x;
startY2=event.target.y;
function dropIt3(event:MouseEvent):void {
event.target.stopDrag();
var myTargetName:String="target"+event.target.name;
var myTarget:DisplayObject=getChildByName(myTargetName);
if (event.target.dropTarget != null &&
event.target.dropTarget.name == "instance112") {
reply2_txt.text="Good Job!";
event.target.removeEventListener(MouseEvent.MOUSE_DOWN,
pickUp3);
event.target.removeEventListener(MouseEvent.MOUSE_UP,
dropIt3);
event.target.buttonMode=false;
event.target.x=myTarget.x;
event.target.y=myTarget.y;
var mySound:Sound = new vowels_NAR_goodjob();
mySound.play();
counter3++;
} else {
reply2_txt.text="Try Again!";
event.target.x=startX2;
event.target.y=startY2;
var mySound2:Sound = new vowel_NAR_nopetryagain();
mySound2.play();
if (counter2==5) {
reply2_txt.text="Great Job! You did it!";
gotoAndPlay(3300);
vf_A.buttonMode=true;
vf_E.buttonMode=true;
vf_I.buttonMode=true;
vf_O.buttonMode=true;
vf_U.buttonMode=true; -
Help with two scripts - Mounting remote DMG and Checking which network I'm connected to
Hey guys, I need some help with two separate scripts:
1. The first script I'm trying to create to mount a DMG stored remotely on another Mac using an AppleScript or shell script. Using the following:
set cmd to "hdiutil mount 'afp://username:[email protected]/Lion/Users/username/Desktop/Test.sparseim age'"
do shell script cmd
results in the following error:
error "hdiutil: mount failed - not recognized" number 1
I'm not very experienced regarding AppleScript or using hdiutil, could somebody point out what's wrong with my script?
2. The second script I'm working on to try and essentially prevent the 'Could Not Find Server' Finder dialog when a network mount is unavailable. I guess what I'd like it to do is detect which network I'm connected to, and if I'm connected to the correct network, then mount the shares, otherwise just fail silently without any errors. From the searching I've done, using try statements should do this, but they do not, and I'm still presented with an error dialog after the server cannot be found.
Does anybody have any suggestions on this script? Also, I've seen some tips regarding detecting which wireless network the Mac is connected to, which could work, but what about when connected via Ethernet?
Thanks!Edit: I need to clarify on my first script request:
I need to mount the DMG on the remote Mac, not on the Mac I'm running the script from. -
Can anyone help with the scripting on this file?
Hi, I hope someone with a bigger brain can help me out here.
I've got an existing Flash CS3 file that makes up the result at http://www.infusion-set.com/flash/Elearning/Inset30/inset30_eguide.html.
The client has asked if I could add an extra tab at the top after 'Reconnecting' called 'Contact Us' with link to an extra page. All the design has been done in ActionScript 2 with references to XML files for the dynamic content because it's been done in other languages as well.
I've amended the existing XML file with the correct references for a new page and an accompanying .swf file to play in the animation area.
I've attempted a .fla version where I duplicated one of the existing tabs script, changed the XML references and changed the variables where necessary to 'con or 'Con' (representing Contact Us). Unfortunately it made the tab menu go completely off the page and was obviously wrong in some way.
Can anyone give me a clue as to what to change here on the original file as I'm a bit of a novice with ActionScripts, hence me asking.
For reference I've attached HTML files with the original file scripts and my incorrect version. The timeline is 103 frames with the scripts placed at frame 1 and 102
Thanks.
GarryThe 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 that for the con button.
You have it calling on something with a linkage name of "con", which a quick check tells me doesn't exist--so 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 mentioned you should try. So the first thing you want to do is 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 that serves that purpose in the library. Then you want to correct the _x assignment of the buttons to what I think you had earlier...
newConBut._x = 650-newConBut._width;
newRecBut._x = newConBut._x-newRecBut._width;
Here is a picture of what those changes do (note, without the XML file I had to finagle things just to work, so the biutton labels aren't what they will be)... -
Help With dynamic scripting for Dervied Property
Hi,
I am trying to get the the list of child nodes and then loopthorugh those nodes to do some calculation in a derived propety using dynamic scripting. I tried with below script.
var childEnumerator = node.GetChildEnumerator();
while(childEnumerator.MoveNext())
var propValue = childEnumerator.GetCurrent().PropValue("Custom.Salary");
print(propValue);
While Evaluating this script I am getting below mentioned error. Any idea what i am missing here?
DRM-16008: There was an error calculating Script property Custom.TotalSalaryExp for EMP_Zone/Emp/PPD1: TypeError: 'GetChildEnumerator' is not a function
Please help me out. thanks fr your co-operation
Regards,
SudiptaTry this instead...
var childEnumerator = node.GetChildEnumerator();
childEnumerator.MoveNext();
while(childEnumerator.GetCurrent() != null)
var propValue = childEnumerator.GetCurrent().PropValue("Custom.Salary");
print(propValue);
childEnumerator.MoveNext(); -
Hi guys,
I need some scripting help with a formula I am trying to create. Basically, the RWDerived property should replace the Spaces in the descrption of a node with an underscore "_". The description property is the system description property. Thanks.
-- AdiFrom the user guide:
"The ReplaceStr function, which requires parameters for the old and new pattern, can take
comma, space, tab, crlf, cr, lf, openparen, or closeparen, in square brackets ([]), in
addition to normal text strings."
It's much better to use "[space]" in your formula so that it won't break if someone edits it and changes the way whitespace is handled down the road. That checkbox is such an annoyance! -
Help with action script number guessing game
can someone help me in flash cs6 to make a simple guessing game, i just need help with the coding. making a guessing game from 1-100
The constructor is coded to assign a random number for
the user to guess
• In the section of code indicated by the comments
(within the handler function doGuess()), write condition
statements that guide the user to guessing the number
using text written to the output
• Trace out the users' guess, plus a message
• Messages for the user depending how close they are from the
guess, condition each of the following:
• Guesses correctly, +/-1 from the guess, +/-10 from the guess,
+/-20 from the guess, +/-40 from the guess, all other guessesclose, it's actually an in class practice lab. After doing this we have to do another one that needs to be submitted. I just need help with the coding for this because i dont know how to start at all. let alone the actual lab.
-
Help with simple applet - dragging box
Hi I need help with a simple applet concept.
I have a picture drawn in the background, but I need to draw a square and resize it when I drag.
So with the picture in the background I click, drag the mouse, and it draws a rectangle from the starting point to where the mouse is while the mouse is clicked.
The only problem is I can't figure out how to do this without redrawing the whole picture. If I don't repaint, it just keeps stretching around rectangles and leaving them there.
I don't really need exact code, just an idea on how to do this without repainting the background every time the mouse is moved (because the picture in the background is complicated to draw and takes like a second).
Thanks
[nvm, found out about xormode]
Edited by: BugMenOTdhzj on Nov 30, 2009 4:47 PMBugMenOTdhzj wrote:
..the picture in the background is complicated to draw and takes like a second).Paint the 'picture in the background' to a BufferedImage, then when it comes to paint()/paintComponent(), draw the BI to the Graphics object (clipped, if necessary (1)), then draw the rectangle to the Graphics object. This would be further optimised at time of rendering, by drawing both the 'picture in the background' BI and rectangle to a second BI, and finally writing that 2nd BI to the Graphics object.
1) There are potentially other improvements that can be made, particularly with clipping, but I suspect if you try as I suggested, the rendering will be very quick and responsive. I have 40 FPS sound trace animations that do a great deal more on each call to paintComponent(), before bursting the final BI to screen. -
Beginner needs help with simple code.
I just statrted learnind java, and I need some help with this simple program. For some reason everytime I enter my Farenheit value, the Celsius conversion returns as 0.0. Would really appreciate the help. Thanks.
Here's the code:
public class TempConverter
public static void main(String[] args)
double F = Double.parseDouble(args[0]);
System.out.println("Temperature in Farenheit is: " + F);
double C = 5 / 9;
C *= (F - 32);
System.out.println("Temperature in Celsius is: " + C);
}double C = 5 / 9This considers "5" and "9" to be integers and does an integer division, discarding the remainder. The result of that division is 0. Trydouble C = 5.0/9.0;
Maybe you are looking for
-
I recently upgraded to Snow Leopard and was missing the drivers for my HP 5000 printer. I got the drivers from HP and downloaded them. When I unzipped the file, my computer went to the login page. I logged in but it stays on that page. Can't get to d
-
Sharepoint 2013 Upload documents error
I have users in Europe that are unable to upload their documents to Sharepoint, we hare just going LIVE with Sharepoint and have come across this issue, any help would be appriciated. [Forced due to logging gap, cached @ 02/14/2014 09:11:11.46, Origi
-
I occasionally can get a few pixels near the left side of the monitor, and 2014.1 would display the lower half of the frame, but now, after the 2014.2 update, I can't even get that much. Premiere is monitoring perfectly. Any suggestions welcome!
-
Autosave in Illustrator CS4?!
Hi good afternoon. My name is Joan, and was working with Adobe Illustrator CS4 and kept my job at the end of the file, then I closed the program and asked if I wanted to replace the file and I said yes, thinking it would keep just the last change. B
-
HP Photosmart C6180 All-in-One won't print magenta or light magenta, even with new cartridges
The printer suddenly stopped printing magenta and light magenta. I installed new cartridges from LD, which have always worked in the past, but none worked. No error messages.