Help with conditional statements
i am being forced to develope a game and really only know the
basics of flash. What i need to have happen is have a movie clip
drag something but only when the clip is in its closed position.
Essentially it would be like having a movie clip of a hand that
opened and closed and when the hand was closed you could press a
button to make it drag something. Can anyone help me with the code
i need for this.
Any help would be appreiciated.
You didn't say whether the hand movie clip is looping its
action or not.
Assuming that the clip constantly loops between an opened and
closed hand, here is a simple script.
First, determine which frame number is the open hand (and it
should come AFTER the open position). In my examples, I'll assume
that the hand closes on frame 20 inside the movie clip.
Second, give your movie clip an instance name. In this
example, I'll call it "hand".
Finally, place this script in an empty keyframe on the root
timeline, either at frame 1, or at the same frame number where the
hand first appears:
hand.onPress = function() {
if (this._currentframe>=20) {
this.stop();
this.startDrag();
hand.onRelease = function() {
this.stopDrag();
this.play();
Hope this helps.
Similar Messages
-
Need help with conditional query
guys this is just an extension of this post that Frank was helping me with. im reposting because my requirements have changes slightly and im having a hell of a time trying to modify the query.
here is the previous post.
need help with query that can look data back please help.
CREATE TABLE "FGL"
"FGL_GRNT_CODE" VARCHAR2(60),
"FGL_FUND_CODE" VARCHAR2(60),
"FGL_ACCT_CODE" VARCHAR2(60),
"FGL_ORGN_CODE" VARCHAR2(60),
"FGL_PROG_CODE" VARCHAR2(60),
"FGL_GRNT_YEAR" VARCHAR2(60),
"FGL_PERIOD" VARCHAR2(60),
"FGL_BUDGET" VARCHAR2(60)
)data
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','00','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7200','4730','02','10','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7600','4730','02','10','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','2','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','11','2','600');
I need to find the greatest grant year for the grant by a period parameter.
once i find the greatest year i need to check the value of period 14 for that grant for the previous year and add it to the budget amount for that grant. however if their is an entry in the greatest year for period 00 then i need to ignore the period 14 of previous year and do this calculation current period +(current period - greatest year 00)
hope that makes sense so in other words with the new data above. if i was querying period two of grant year 11. i would end up with $800
because the greatest year is 11 it contains a period 0 with amount of $400 so my total should be
period 2 amount $ 600
period 0 amount $ 400 - period 2 amount of $600 = 200
600+200 = $800
if i query period 1 of grant 360055 i would just end up with 800 of grnt year 10.
i have tried to modify that query you supplied to me with no luck. I have tried for several day but im embarrased to say i just can get it to do what im trying to do .
can you please help me out.
here is the query supplied by frank kulash who gracefully put this together for me.
WITH got_greatest_year AS
SELECT fgl.* -- or whatever columns are needed
, MAX ( CASE
WHEN fgl_period = :given_period
THEN fgl_grnt_year
END
) OVER () AS greatest_year
FROM fgl
SELECT SUM (fgl_budget) AS total_budget -- or SELECT *
FROM got_greatest_year
WHERE ( fgl_grnt_year = greatest_year
AND fgl_period = :given_period
OR ( fgl_grnt_year = greatest_year - 1
AND fgl_period = 14
;MiguelHi, Miguel,
Are you waying that, when the greatest year that has :given_period also has period='00' (or '0', or whatever you want to use), then you want to double the budget from the given_period (as well as subtract the budget from the '00', and not count the pevious year's '14')? If so, add another condition to the CASE statement which decides what you're SUMming:
WITH got_greatest_year AS
SELECT TO_NUMBER (fgl_grnt_year) AS grnt_year
, fgl_period
, TO_NUMBER (fgl_budget) AS budget
, MAX ( CASE
WHEN fgl_period = :given_period
THEN TO_NUMBER (fgl_grnt_year)
END
) OVER () AS greatest_year
FROM fgl
, got_cnt_00 AS
SELECT grnt_year
, fgl_period
, budget
, greatest_year
, COUNT ( CASE
WHEN grnt_year = greatest_year
AND fgl_period = '00'
THEN 1
END
) OVER () AS cnt_00
FROM got_greatest_year
SELECT SUM ( CASE
WHEN grnt_year = greatest_year -- New
AND fgl_period = :given_period -- New
AND cnt_00 > 0 THEN budget * 2 -- New
WHEN grnt_year = greatest_year
AND fgl_period = :given_period THEN budget
WHEN grnt_year = greatest_year
AND fgl_period = '00' THEN -budget
WHEN grnt_year = greatest_year - 1
AND fgl_period = '14'
AND cnt_00 = 0 THEN budget
END
) AS total_budget
FROM got_cnt_00
;You'll notice this is the same as the previous query I posted, except for 3 lines maked "New". -
Help with conditions AND installer Packages
Hello everyone,
I need help still learning.
My shell is SHELL=/bin/sh based on env command
I am trying to write a package with Iceberg to push Office 2004 to 250 Macs. I need a preflight script with a condition that will stop my script if /Applications/Microsoft Office 2004 exists OR if OFFICE 2004 exists. Don't know if searching on the folder name is the best or if there is better way
If it doesn't exist I want it to continue with with placing Office 2004 in the /Applications folder.
I don't know how to do conditions (If, then, end)
PREFLIGHT SCRIPT
IF /Applications/Microsoft Office 2004 folder exist = STOP
IF /Applications/Microsoft Office 2004 folder doesn't exist continue with laying down files/folder in the package.
LAYDOWN FILES
LAY DOWN FILES IN ICEBERG FILE SECTION OF THE PACKAGE
POSTFLIGHT SCRIPT
#!/bin/sh
#Change to root directory
cd /
# Move Microsoft Office X folder to Messages Received folder
mv /Applications/Microsoft\ Office\ X /Messages\ Received
#Open Office 2004 Installer
open /Applications/Utilities/Installers/Office2004Installer
G4 1.42 Mac OS X (10.3.5)Hi Dmcrory,
The answer to your question about ORing tests in a shell conditional statement could be something along the lines of:
if [ -d /Applications/Microsoft\ Office\ 2004 -o -d "/Applications/OFFICE 2004" ]
then
exit 1
fi
I've included two different styles of quoting so you can choose which you prefer.
That said, you appear to be asking us how to write shell scripts, starting from scratch. Time that you spend studying benefits you forever and sometimes benefits us, while time we spend doing your work is at best a trivial review for us. The above "-o" option, and many others, are documented at the compound comparison section of the Advanced Bash-Scripting Guide. Don't let the name fool you; the Guide actually assumes very little. The "Advanced" adjective refers to the completeness of work. In fact there are many good references.
I used to have a long post of links to what I think are some of the better beginning UNIX tutorials and books. However, as others posted great links and I stole them, my post became too long so I put it in a web page. Bill Scott did the same thing so here is Bill's and here is mine.
This is being written after reading your exchange with Roger. When you execute code that doesn't work, we certainly have no chance of knowing why without seeing the code. It generally helps a lot to see the output as well.
Gary
~~~~
University politics are vicious precisely because the
stakes are so small.
-- C. P. Snow -
Help with if statement in cursor and for loop to get output
I have the following cursor and and want to use if else statement to get the output. The cursor is working fine. What i need help with is how to use and if else statement to only get the folderrsn that have not been updated in the last 30 days. If you look at the talbe below my select statement is showing folderrs 291631 was updated only 4 days ago and folderrsn 322160 was also updated 4 days ago.
I do not want these two to appear in my result set. So i need to use if else so that my result only shows all folderrsn that havenot been updated in the last 30 days.
Here is my cursor:
/*Cursor for Email procedure. It is working Shows userid and the string
You need to update these folders*/
DECLARE
a_user varchar2(200) := null;
v_assigneduser varchar2(20);
v_folderrsn varchar2(200);
v_emailaddress varchar2(60);
v_subject varchar2(200);
Cursor c IS
SELECT assigneduser, vu.emailaddress, f.folderrsn, trunc(f.indate) AS "IN DATE",
MAX (trunc(fpa.attemptdate)) AS "LAST UPDATE",
trunc(sysdate) - MAX (trunc(fpa.attemptdate)) AS "DAYS PAST"
--MAX (TRUNC (fpa.attemptdate)) - TRUNC (f.indate) AS "NUMBER OF DAYS"
FROM folder f, folderprocess fp, validuser vu, folderprocessattempt fpa
WHERE f.foldertype = 'HJ'
AND f.statuscode NOT IN (20, 40)
AND f.folderrsn = fp.folderrsn
AND fp.processrsn = fpa.processrsn
AND vu.userid = fp.assigneduser
AND vu.statuscode = 1
GROUP BY assigneduser, vu.emailaddress, f.folderrsn, f.indate
ORDER BY fp.assigneduser;
BEGIN
FOR c1 IN c LOOP
IF (c1.assigneduser = v_assigneduser) THEN
dbms_output.put_line(' ' || c1.folderrsn);
else
dbms_output.put(c1.assigneduser ||': ' || 'Overdue Folders:You need to update these folders: Folderrsn: '||c1.folderrsn);
END IF;
a_user := c1.assigneduser;
v_assigneduser := c1.assigneduser;
v_folderrsn := c1.folderrsn;
v_emailaddress := c1.emailaddress;
v_subject := 'Subject: Project for';
END LOOP;
END;
The reason I have included the folowing table is that I want you to see the output from the select statement. that way you can help me do the if statement in the above cursor so that the result will look like this:
emailaddress
Subject: 'Project for ' || V_email || 'not updated in the last 30 days'
v_folderrsn
v_folderrsn
etc
[email protected]......
Subject: 'Project for: ' Jim...'not updated in the last 30 days'
284087
292709
[email protected].....
Subject: 'Project for: ' Kim...'not updated in the last 30 days'
185083
190121
190132
190133
190159
190237
284109
286647
294631
322922
[email protected]....
Subject: 'Project for: Joe...'not updated in the last 30 days'
183332
183336
[email protected]......
Subject: 'Project for: Sam...'not updated in the last 30 days'
183876
183877
183879
183880
183881
183882
183883
183884
183886
183887
183888
This table is to shwo you the select statement output. I want to eliminnate the two days that that are less than 30 days since the last update in the last column.
Assigneduser....Email.........Folderrsn...........indate.............maxattemptdate...days past since last update
JIM......... jim@ aol.com.... 284087............. 9/28/2006.......10/5/2006...........690
JIM......... jim@ aol.com.... 292709............. 3/20/2007.......3/28/2007............516
KIM......... kim@ aol.com.... 185083............. 8/31/2004.......2/9/2006............. 928
KIM...........kim@ aol.com.... 190121............. 2/9/2006.........2/9/2006.............928
KIM...........kim@ aol.com.... 190132............. 2/9/2006.........2/9/2006.............928
KIM...........kim@ aol.com.... 190133............. 2/9/2006.........2/9/2006.............928
KIM...........kim@ aol.com.... 190159............. 2/13/2006.......2/14/2006............923
KIM...........kim@ aol.com.... 190237............. 2/23/2006.......2/23/2006............914
KIM...........kim@ aol.com.... 284109............. 9/28/2006.......9/28/2006............697
KIM...........kim@ aol.com.... 286647............. 11/7/2006.......12/5/2006............629
KIM...........kim@ aol.com.... 294631............. 4/2/2007.........3/4/2008.............174
KIM...........kim@ aol.com.... 322922............. 7/29/2008.......7/29/2008............27
JOE...........joe@ aol.com.... 183332............. 1/28/2004.......4/23/2004............1585
JOE...........joe@ aol.com.... 183336............. 1/28/2004.......3/9/2004.............1630
SAM...........sam@ aol.com....183876.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183877.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183879.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183880.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183881.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183882.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183883.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183884.............3/5/2004.........3/8/2004............ 1631
SAM...........sam@ aol.com....183886.............3/5/2004.........3/8/2004............ 1631
SAM...........sam@ aol.com....183887.............3/5/2004.........3/8/2004............ 1631
SAM...........sam@ aol.com....183888.............3/5/2004.........3/8/2004............ 1631
PAT...........pat@ aol.com.....291630.............2/23/2007.......7/8/2008............ 48
PAT...........pat@ aol.com.....313990.............2/27/2008.......7/28/2008............28
NED...........ned@ aol.com.....190681.............4/4/2006........8/10/2006............746
NED...........ned@ aol.com......95467.............6/14/2006.......11/6/2006............658
NED...........ned@ aol.com......286688.............11/8/2006.......10/3/2007............327
NED...........ned@ aol.com.....291631.............2/23/2007.......8/21/2008............4
NED...........ned@ aol.com.....292111.............3/7/2007.........2/26/2008............181
NED...........ned@ aol.com.....292410.............3/15/2007.......7/22/2008............34
NED...........ned@ aol.com.....299410.............6/27/2007.......2/27/2008............180
NED...........ned@ aol.com.....303790.............9/19/2007.......9/19/2007............341
NED...........ned@ aol.com.....304268.............9/24/2007.......3/3/2008............ 175
NED...........ned@ aol.com.....308228.............12/6/2007.......12/6/2007............263
NED...........ned@ aol.com.....316689.............3/19/2008.......3/19/2008............159
NED...........ned@ aol.com.....316789.............3/20/2008.......3/20/2008............158
NED...........ned@ aol.com.....317528.............3/25/2008.......3/25/2008............153
NED...........ned@ aol.com.....321476.............6/4/2008.........6/17/2008............69
NED...........ned@ aol.com.....322160.............7/3/2008.........8/21/2008............4
MOE...........moe@ aol.com.....184169.............4/5/2004.......12/5/2006............629
[email protected]/27/2004.......3/8/2004............1631
How do I incorporate a if else statement in the above cursor so the two days less than 30 days since last update are not returned. I do not want to send email if the project have been updated within the last 30 days.
Edited by: user4653174 on Aug 25, 2008 2:40 PManalytical functions: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions2a.htm#81409
CASE
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/02_funds.htm#36899
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/04_struc.htm#5997
Incorporating either of these into your query should assist you in returning the desired results. -
Hi,
First Special thanks to Kglad for the help with the AS1 to AS3 conversion.
I've been able to link up my buttons to play a different frames of the movie. this was my novice way of finally getting the programming to work.
In frame 95 I have
var myLoader:Loader = new Loader();
addChild(myLoader); var url:URLRequest = new URLRequest("page1.swf");
myLoader.load(url);
in frame 165:
var myLoader1:Loader = new Loader();
addChild(myLoader1); var url1:URLRequest = new URLRequest("page1.swf");
myLoader1.load(url1);
My buttons link to 116 which plays a frame and loads ^
in frame 226: removeChild(myLoader).
But if the user has looped back into home from another part in the movie clip then it would need to remove myLoader1 instead of myLoader.
I'm guessing there is some really dynamic way to solve the programatic nightmare i'm developing, but I'm really novice.
So what i need is an if statement for frame 226
That would do something:
if(myLoader <> null
removeChild(myLoader)
else(
removechild(myLoader1)
Anyone have a method for this?yes, you can use the same urlrequest but just change its url property:
// initialize, for example in frame 1. this is done once and never again:
var loader:Loader=new Loader();
var urlR:URLRequest=new URLRequest();
// then in frame 2, for example:
urlR.url="page1.swf";
loader.load(urlR);
// in frame 20, for example:
urlR.url="page2.swf";
loader.load(urlR);
// in frame 30, for example:
urlR.url="page3.swf";
loader.load(urlR);
//etc. if you're loading any swfs that play streams (sound or video), you'll want to add some code to this. -
Help with Conditional Display and Validation
Version 4.1.1.00.23
Hello,
I'm having a difficult time with a conditional display and validation I'm hoping someone can help with.
Requirements:
When the Start Date (Datepicker) and/or End Date (Datepicker) change then display the Change Reason (Select List) and Change Description (Textbox)
If the page is saved without entering a Change Reason display a validation error message that the Change Reason cannot be empty (NULL)
What I've tried
Create a Dynamic Action on the Start Date
Event: Change
Selection Type:Item(s)
Items(s): P51_START_DATE
Condition: none
True Action Section:
Action: Show
Fire on Page Load: Checked
Show all page items on the same line: No
Affected Items Section:
Selection Type:Item(s)
Item(s): P51_CHANGE_REASON,P51_CHANGE_DESC
I've also created a Dynamic Action with similar settings for the P51_END_DATE.
I created a Validation for the P51_CHANGE_REASON as Function Returning Error Text:
DECLARE
v_start_date work_items.start_date%TYPE;
v_end_date work_items.end_date%TYPE;
BEGIN
SELECT start_date
,end_date
INTO v_start_date
,v_end_date
FROM work_items
WHERE work_items_id = :P51_WORK_ITEMS_ID;
IF ( (v_start_date != TO_DATE(:P51_START_DATE,'DD-MON-YYYY') OR v_end_date != TO_DATE(:P51_END_DATE,'DD-MON-YYYY') ) AND
:P51_CHANGE_REASON IS NULL ) THEN
RETURN 'Change Reason must have a value';
END IF;
END;
The Issue
I tried to create another Dynamic Action to hide the P51_CHANGE_REASON and P51_CHANGE_DESC fields on page load, but when either of the date fields are changed and the validation is fired the P51_CHANGE_REASON and P51_CHANGE_DESC are hidden again.
There are two buttons to submit the page: 'SAVE' will submit the page and stay on the page and 'SAVE_CHANGES' will submit the page and branch to the previous page (which is a report with EDIT buttons to edit the record).
I can't get the page load Dynamic Action to NOT fire when the validation is fired.
I hope this is clear and if not what information can I provide?
Thanks,
JoePhil,
Thank you for looking at this.
Yes if the Change Reason is NULL when the edit page is displayed then the Change Reason and Change Description fields are hidden. If the Start Date (Datepicker) and/or End Date (Datepicker) change then display the Change Reason (Select List) and Change Description (Textbox). If the page is saved without entering a Change Reason display a validation error message that the Change Reason cannot be empty (NULL).
The problem I'm having is that if no Change Reason is entered and the page is saved thereby firing the validation the Change Reason and Change Description fields are hidden again (because of the On-Load Dynamic Action to hide them). So now the user can't put in a Change Reason...unless they change one of the date fields again which isn't going to be accepted.
Is there a way to determine if a validation error was fired and be able to use that on the On-Load Dynamic Action to hide the two fields? Something like...If the validation fired then don't run?
Please let me know if I'm still confusing you.
Thanks,
Joe -
Need Help W/ Conditional Statement...
Hi guys,
I have a project uploaded at:
http://www.jasonfraziercreativedesign.com/client_sites/kimyarbrough2/
After everything has loaded into place, and you click on -- say MODELING -- the photos slide away, the separator bars disappear, and the particular (sample) content is loaded in. This works wonderfully for all the buttons (MODELING, ACTING, MUSIC, SCHEDULE and ABOUT KIM) -- but only when you click on them when the site first loads.
If you try to click on the buttons again, when you're IN a section -- it will cycle through the animation again.
I know I need some kind of conditional statement that says if you're ALREADY LOOKING AT A SECTION (i.e. the sourceLoader.source = a section) then don't cycle through the animation again -- just get rid of the current content and display the appropriate new content.
If you're IN the MODELING SECTION, for instance and you click MODELING again -- I don't want Flash to do ANYTHING (ie NULL). But if you're in MODELING, and you click on ACTING -- I just want the MODELING stuff to go away and present the ACTING stuff (no animation).
Here's the pertinent AS that I have currently -- any help about where to place the proper CONDITIONAL (if/else) statement would be so appreciated:
function swap_photos_place_content(theSection:String):void {
// ANIMATE THE 4 PANEL PHOTOS LEAVING THE CONTENT AREA
var photo1Tween:Tween = new Tween(kim_photo1_mc, "y", Regular.easeOut, kim_photo1_mc.y, 620, 2, true);
var photo2Tween:Tween = new Tween(kim_photo2_mc, "y", Regular.easeOut, kim_photo2_mc.y, -600, 2, true);
var photo3Tween:Tween = new Tween(kim_photo3_mc, "y", Regular.easeOut, kim_photo3_mc.y, 620, 2, true);
var photo4Tween:Tween = new Tween(kim_photo4_mc, "y", Regular.easeOut, kim_photo4_mc.y, -600, 2, true);
// AFTER THE LAST PHOTO HAS MOVED OUT, FADE UP THE CONTENT MASK
photo4Tween.addEventListener(TweenEvent.MOTION_FINISH, fadeup_content_mask);
function fadeup_content_mask(event:TweenEvent):void {
var main_mask_fadeoutTween:Tween = new Tween(main_mask_mc, "alpha", Regular.easeOut, 1, 0, 1, true );
var content_mask_fadeupTween:Tween = new Tween(content_mask_mc, "alpha", Regular.easeOut, 0, 1, 1, true);
// AFTER THE CONTENT MASK FADES UP, THE STAGE IS READY TO LOAD IN THE CONTENT
content_mask_fadeupTween.addEventListener(TweenEvent.MOTION_FINISH, load_in_content);
function load_in_content(event:TweenEvent):void {
// BEFORE LOADING IN THE NEW SECTION, TAKE AWAY THE OLD SECTION
sectionLoader.source=null;
trace("ready to load in content");
sectionLoader.source=theSection;
// ADD LISTENERS FOR THE SECTION-CONTENT CLICKS
inv_modeling_button.addEventListener(MouseEvent.CLICK, modeling_click);
function modeling_click(event:MouseEvent):void {
trace("modeling_click");
swap_photos_place_content("modeling.swf");
inv_acting_button.addEventListener(MouseEvent.CLICK, acting_click);
function acting_click(event:MouseEvent):void {
trace("acting_click");
swap_photos_place_content("acting.swf");
inv_music_button.addEventListener(MouseEvent.CLICK, music_click);
function music_click(event:MouseEvent):void {
trace("music_click");
swap_photos_place_content("music.swf");
inv_schedule_button.addEventListener(MouseEvent.CLICK, schedule_click);
function schedule_click(event:MouseEvent):void {
trace("schedule_click");
swap_photos_place_content("schedule.swf");
inv_aboutkim_button.addEventListener(MouseEvent.CLICK, aboutkim_click);
function aboutkim_click(event:MouseEvent):void {
trace("aboutkim_click");
swap_photos_place_content("aboutkim.swf");One thing you can do is create a function that removes all the event listeners for all the buttons. Then when you click a button run that function then add event listeners for all other buttons.
-
Help with Switch statements using Enums?
Hello, i need help with writing switch statements involving enums. Researched a lot but still cant find desired answer so going to ask here. Ok i'll cut story short.
Im writing a calculator program. The main problem is writing code for controlling the engine of calculator which sequences of sum actions.
I have enum class on itself. Atm i think thats ok. I have another class - the engine which does the work.
I planned to have a switch statement which takes in parameter of a string n. This string n is received from the user interface when users press a button say; "1 + 2 = " which each time n should be "1", "+", "2" and "=" respectively.
My algorithm would be as follows checking if its a operator(+) a case carry out adding etc.. each case producing its own task. ( I know i can do it with many simple if..else but that is bad programming technique hence im not going down that route) So here the problem arises - i cant get the switch to successfully complete its task... How about look at my code to understand it better.
I have posted below all the relevant code i got so far, not including the swing codes because they are not needed here...
ValidOperators v;
public Calculator_Engine(ValidOperators v){
stack = new Stack(20);
//The creation of the stack...
this.v = v;
public void main_Engine(String n){
ValidOperators v = ValidOperators.numbers;
*vo = vo.valueOf(n);*
switch(v){
case Add: add(); break;
case Sub: sub(); break;
case Mul: Mul(); break;
case Div: Div(); break;
case Eq:sum = stack.sPop(); System.out.println("Sum= " + sum);
default: double number = Integer.parseInt(n);
numberPressed(number);
break;
//default meaning its number so pass it to a method to do a job
public enum ValidOperators {
Add("+"), Sub("-"), Mul("X"), Div("/"),
Eq("="), Numbers("?"); }
Notes*
It gives out error: "No enum const class ValidOperators.+" when i press button +.
It has nothing to do with listeners as it highlighted the error is coming from the line:switch(v){
I think i know where the problem is.. the line "vo = vo.valueOf(n);"
This line gets the string and store the enum as that value instead of Add, Sub etc... So how would i solve the problem?
But.. I dont know how to fix it. ANy help would be good
Need more info please ask!
Thanks in advance.demo:
import java.util.*;
public class EnumExample {
enum E {
STAR("*"), HASH("#");
private String symbol;
private static Map<String, E> map = new HashMap<String, E>();
static {
put(STAR);
put(HASH);
public String getSymbol() {
return symbol;
private E(String symbol) {
this.symbol = symbol;
private static void put(E e) {
map.put(e.getSymbol(), e);
public static E parse(String symbol) {
return map.get(symbol);
public static void main(String[] args) {
System.out.println(E.valueOf("STAR")); //succeeds
System.out.println(E.parse("*")); //succeeds
System.out.println(E.parse("STAR")); //fails: null
System.out.println(E.valueOf("*")); //fails: IllegalArgumentException
} -
Help with if statement for a beginner.
Hello, Im new to the dev lark and wondered if someone could point me in the right direction.
I have the following (working!) app that lets users press a few buttons instead of typing console commands (please do not be too critical of it, its my first work prog).
//DBS File send and Receive app 1.0
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import java.applet.Applet;
public class Buttons extends JFrame
public Buttons()
super("DBS 2");
JTextArea myText = new JTextArea ("Welcome to the DBS application." +
"\n" +
"\n\n1. If you have received an email informing you that the DBS is ready to dowload please press the \"Receive DBS\" button." +
"\n" +
"\n1. Once this has been Received successfully please press the \"Prep File\" button." +
"\n\n2. Once the files have been moved to their appropriate locations, please do the \"Load\" into PAS." +
"\n\n3. Once the \"Load\" is complete, do the \"Extract\"." +
"\n\n4. When the \"Extract\" has taken place please press the \"File Shuffle\" button." +
"\n\n5. When the files have been shuffled, please press the \"Send DBS\" Button." +
"\n\nJob done." +
"\n", 20,50);
JPanel holdAll = new JPanel();
JPanel topPanel = new JPanel();
JPanel bottomPanel = new JPanel();
JPanel middle1 = new JPanel();
JPanel middle2 = new JPanel();
JPanel middle3 = new JPanel();
topPanel.setLayout(new FlowLayout());
middle1.setLayout(new FlowLayout());
middle2.setLayout(new FlowLayout());
middle3.setLayout(new FlowLayout());
bottomPanel.setLayout(new FlowLayout());
myText.setBackground(new java.awt.Color(0, 0, 0));
myText.setForeground(new java.awt.Color(255,255,255));
myText.setFont(new java.awt.Font("Times",0, 16));
myText.setLineWrap(true);
myText.setWrapStyleWord(true);
holdAll.setLayout(new BorderLayout());
topPanel.setBackground(new java.awt.Color(153, 101, 52));
bottomPanel.setForeground(new java.awt.Color(153, 0, 52));
holdAll.add(topPanel, BorderLayout.CENTER);
topPanel.add(myText, BorderLayout.NORTH);
setSize(700, 600);
setDefaultCloseOperation(EXIT_ON_CLOSE);
getContentPane().add(holdAll, BorderLayout.CENTER);
Container c = getContentPane();
c.setLayout(new FlowLayout());
final JButton receiveDBS = new JButton("Receive DBS"); //marked as final as it is called in an Inner Class later
final JButton filePrep = new JButton("Prep File");
final JButton fileShuffle = new JButton("File Shuffle");
final JButton sendDBS = new JButton("Send DBS");
JButton exitButton = new JButton("Exit");
// JLabel statusbar = new JLabel("Text here");
receiveDBS.setFont(new java.awt.Font("Arial", 0, 25));
filePrep.setFont(new java.awt.Font("Arial", 0, 25));
fileShuffle.setFont(new java.awt.Font("Arial", 0, 25));
sendDBS.setFont(new java.awt.Font("Arial", 0, 25));
exitButton.setBorderPainted ( false );
exitButton.setMargin( new Insets ( 10, 10, 10, 10 ));
exitButton.setToolTipText( "EXIT Button" );
exitButton.setFont(new java.awt.Font("Arial", 0, 20));
exitButton.setEnabled(true); //Set to (false) to disable
exitButton.setForeground(new java.awt.Color(0, 0, 0));
exitButton.setHorizontalTextPosition(SwingConstants.CENTER); //Don't know what this does
exitButton.setBounds(10, 30, 90, 50); //Don't know what this does
exitButton.setBackground(new java.awt.Color(153, 101, 52));
topPanel.add(receiveDBS);
middle1.add(filePrep);
middle2.add(exitButton);
middle3.add(fileShuffle);
bottomPanel.add(sendDBS);
receiveDBS.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent ae)
if (ae.getSource() == receiveDBS);
try
Runtime.getRuntime().exec("cmd.exe /c start c:\\DBS\\ReceiveDBSfile.bat");
catch(Exception e)
System.out.println(e.toString());
e.printStackTrace();
filePrep.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent ae)
if (ae.getSource() == filePrep);
try
Runtime.getRuntime().exec("cmd.exe /c start c:\\DBS\\filePrep.bat");
catch(Exception e)
System.out.println(e.toString());
e.printStackTrace();
exitButton.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent ae)
System.exit(0);
fileShuffle.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent ae)
if (ae.getSource() == fileShuffle);
try
Runtime.getRuntime().exec("cmd.exe /c start c:\\DBS\\fileShuffle.bat");
catch(Exception e)
System.out.println(e.toString());
e.printStackTrace();
sendDBS.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent ae)
if (ae.getSource() == sendDBS);
try
Runtime.getRuntime().exec("cmd.exe /c start c:\\DBS\\sendDBSFile.bat");
catch(Exception e)
System.out.println(e.toString());
e.printStackTrace();
c.add(receiveDBS);
c.add(filePrep);
c.add(fileShuffle);
c.add(sendDBS);
c.add(exitButton);
// c.add(statusbar);
public static void main(String args[])
Buttons xyz = new Buttons();
xyz.setVisible(true);
}What I would like help with is the following
I would like output to either a JLabel or JTextArea to appear if a file appears on the network. Something along these lines
If file named nststrace*.* is in \\[network path] then output Download successful, please proceed.
btw I have done my best to search this forum for something similar and had no luck, but I am looking forward to Encephalopathics answer as he/she has consistently made me laugh with posted responses (in a good way).
Thanks in advance, Paul.Hospital_Apps_Monkey wrote:
we're starting to get aquainted, but I think "best friend" could take a while as it is still as hard going as I recall, but I will persevere.Heh, it's not so bad! For example, if I had no idea how to test whether a file exists, I would just scan the big list of classes on the left for names that sound like they might include File operations. Hey look, File! Then I'd look at all of File's methods for something that tests whether it exists or not. Hey, exists! Then if I still couldn't figure out how to use it, I'd do a google search on that particular method. -
Help with dynamic statement returning values into collection
Hi All
I am trying to use dynamic statement to return values into a collection using the returning clause. However, I get an ORA-00933 error. Here is a simple setup:
create table t(
pk number,
id_batch varchar2(30),
date_created date,
constraint t_pk primary key ( pk )
create or replace type num_ntt is table of number;
create or replace type vc2_ntt is table of varchar2(30);
create or replace
package pkg
as
type rec is record(
pk num_ntt,
id_batch vc2_ntt
procedure p(
p_count in number,
p_rt out nocopy rec
end pkg;
create or replace
package body pkg
as
procedure p(
p_count in number,
p_rt out nocopy rec
is
begin
execute immediate '
insert into t
select level, ''x'' || level, sysdate
from dual
connect by level <= :p_count
returning pk, id_batch into :pk, :id_batch'
using p_count returning bulk collect into p_rt.pk, p_rt.id_batch;
end p;
end pkg;
declare
r pkg.rec;
begin
pkg.p( 5, r );
end;
/sanjeevchauhan wrote:
but I am working with dynamic statement and returning multiple fields into a collection.And using an INSERT...SELECT statement combined with a RETURNING INTO clause still does not work. Whether it's dynamic SQL or not: it doesn't work. The link describes a workaround.
By the way, I don't see why you are using dynamic SQL here. Static SQL will do just fine. And so you can literally copy Adrian's setup.
Regards,
Rob. -
Need help with Object States or Buttons?
I currently work in InDesign to compile layouts and present design decks to clients. Our template includes an approval section (Not Approved, Revised, Approved) that we currently have as white/black bubbles that we change manually on each page. I've been trying to find a way to speed up this process. I know that in InDesign you can create buttons than you can then click on-off on your PDF - we used to do this but it is too time consuming (we have PDF's anywhere from 25-120 pages). I have been playing around with Object States, so we can quickly update the bubbles in InDesign itself as we work.
Does anyone know of a way to change the state of multiple objects on multiple pages at the same time? (For example, if I want to change all pages to "Approved" at the same time - or if I only wanted to do some, but not all, of the pages.)
Can anyone recommend any other InDesign tools that may be able to create a similar function for an "approval" stamp, but that still is done in InDesign (not in the PDF after exporting)?I was hoping that wouldn't be the only way. My have multiple master pages already, and not all pages will be "approved" at the same time. So we've run into issues with putting these on the masters as it gets easier to miss them.
-
Urgent help with If statement please!
HI Everyone
Was wondering if anyone can tell me why flash seems to be
ignoring my If Statements, every time I try to use one it ignores
the condition and just actions the command. Its driving me crazy.
I'm sure I must be doing something wrong I just can't work it out.
I've put;
on (release) {
if ((_root.eyeshadow = "Pink") && (_root.lipy =
"Pink")) {
_root.correct._alpha =100;
It seems to just action the _root.correct._alpha = 100;
even when a different colour is selected.
I was wondering can flash read a variable from another
script, because if not it will not know what eyeshadow and lipy
are. I dont get any error messages though.
Please help somebody!
Thank you,
Stacy.x.Thank you that appears to have made the if statement work,
but now i have another problem.
It doesn't seem to acknowledge wether these selections have
been selected.
I have put in the code for the pink eyeshadow;
on (release) {
_root.eyeshadow2._alpha =0;
_root.eyeshadow1._alpha = 100;
eyeshadow == "Pink";
the same code is in all the other selections, with the name
variations.
any ideas?
.x. -
Help with IF statement in numbers
Hi Community
Please could someone assist with creating a formula.
I have created an exercise log (see image). Now when I input a formula in E, =D2/C2 it gives me my Minutes/km, but in a row containing 'Resistance' it obviously gives me the enoying red beacon.
How can I create an IF/THEN statement, basically IF column C = "0", then 'leave field black', otherwise 'calculate my Minutes/km'.
A solution will be greatly appreciated.
Cheers,
MikeI suggest the following changes:
1) omit the "km" from in each entry of the "Distance" column and simply place it in the column header
2) use the following formula for the "Min / km" column:
E2=IF(C2>0,DURATION(,,,DUR2MINUTES(D2)/C2,), "")
the problem is you cannot divide by 0 (EVER). so you were correct to consider using an if to omit entries where the was no distance.
I hop this helps.
Wayne -
Help with if statement in XPATH
Hi,
I´m using XPath to return a value for a conditional Branch in OSB, I understand that it is supposed to work with standard XPath so I post this question in this forum:
What I want to do should be simple but have not worked for me, I want to do an IF statement and to return one value in the then part or another value in else.
if the statement is acomplished I want tu return just a string and if it does not acomplish then in the else return a value from an Xpath expresion:
here something similar of what I´m trying:
if (./imp:iniciarCambio/cambios/bea:ListaDeCambios/bea:Cambio/bea:campoNombre/text() = "Name")
then M6yBilling
else ./imp:iniciarCambio/cambios/bea:companiaTipo/text()
The part that is not working is where I want to return M6yBilling if the statement acomplishes, I have tried "M6yBilling" also 'M6yBilling' and fn:string(M6yBilling) but none is working at all.
Any ideas?
Kind Regards,
Gerardo Janalytical functions: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions2a.htm#81409
CASE
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/02_funds.htm#36899
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/04_struc.htm#5997
Incorporating either of these into your query should assist you in returning the desired results. -
Need help with IF Statement!!!
I am trying to write an IF statement using FormCalc in LiveCycle. I have cell "tpe" which captures total points. I would like to assign levels based on the number of points achieved. For example, level I = 1001-1985; level II = 851-1000; level III = 551-850; level IV = <551. I want cell "level" to show either I, II, III or IV, based on the points in cell "tpe". How can I do this? I have zero familiarity with FormCalc or scrips in general. Can someone please help me with this? Would appreciate any help!! Thanks!
This is what it says:
topmostSubform.Page3.tpe::calculate - (FormCalc, client)
sum (rrtotal, programtotal, financetotal, leadershiptotal, executivetotal, meetingstotal, filestotal, brotherhoodtotal, conferencetotal, communicationstotal, minutestotal, standardstotal, basileustotal, abtotal, gramtotal, antigramtotal, tamtotal, pgramtotal, partotal, epistotal, torchtotal, hodtotal, phitotal)
if ($ > 1000 and $ <= 1985)then
level = "I"
elseif ($ > 850 and $ <= 1000)then
level = "II"
elseif ($ > 550 and $ <= 850)then
level = "III"
elseif ($ <= 550)then
level = "IV"
else level = ""
endif
Maybe you are looking for
-
Can't create an E-mail acct after mail list by same name has been deleted.
I deleted a mailing list through delegated administrator because the user wants it created as an E-mail account instead. After deleting the list through the delegated administrator interface (and after waiting 1.5 hours!) I still cannot create the E-
-
In Dreamweaver CC why can i not get any workspace options? Where do I find 'Draw AP div' or any of my 'designer' tools?
-
Handling faults -- error pages
We have a web service that, when run under local OC4J, returns the following <soapenv:Fault> <faultcode>Client</faultcode> <faultstring>Invalid parameter</faultstring> <detail> <string> <errorcode>E_InvalidParameter</errorcode> <description><GetFacil
-
Running a Struts Example Program
Hello, Im working on a course work about jakarta struts & I dowloaded an example program from a site, but I can not run it as it always gives me the same error(below). I also tried to run one simple one that I created my self, but still doesn't work
-
Alternative to WMIC csproduct get name?
Everyone, I am currently attempting to find a work around that will allow me to leverage a single WDS/MDT image for all of my PC hardware. At the moment, my biggest hurdle comes from hardware manufacturers that are not properly labeling their hardwar