Use of clone function in actionscript 3.0
I am learning MVC Design pattern. and i got confused in clone function .can any one help me why this clone function is used and how it works.
the code is below
package mvc{
public class Time {
private var _hour:uint;
private var _minute:uint;
private var _seconds:uint;
public function get hour(){
return _hour;
public function set hour(value:unit):void{
_hour = value;
public function get minute(){
return _minute;
public function set minute(value:uint):void{
_minute = value;
public function get seconds(){
return _seconds;
public function set seconds(value:uint):void{
_seconds = value;
public function Time(hour:uint, minute:uint, seconds:uint){
_hour =hour;
_minute=minute;
_seconds=seconds;
public function clone():Time{
return new Time(_hour,_minute,_seconds);
If you created an instance of your time class that you called myTime
var myTime:Time = new Time(15,15,0);
and later you wanted another instance with the same time you could write
var myTime2:Time = myTime.clone()
It is just there for convienience and doesn't have anything much to do with MVC
Similar Messages
-
I'm cloning my MacBook Pro's HDD to a SSD and didn't really want to install another app (SuperDuper, CCC), can I just use the Restore function in Disk Utility app to clone it and make a bootable copy on my SSD?
Thank you for the help!Yes.
Clone Yosemite, Mavericks, Lion/Mountain Lion using Restore Option of Disk Utility
Boot to the Recovery HD:
Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
1. Select Disk Utility from the main menu then press the Continue
button.
2. Select the destination volume from the left side list.
3. Click on the Restore tab in the DU main window.
4. Select the destination volume from the left side list and drag it
to the Destination entry field.
5. Select the source volume from the left side list and drag it to
the Source entry field.
6. Double-check you got it right, then click on the Restore button.
Destination means the external backup drive. Source means the internal startup drive. -
Actionscript 3 Class Not Running More Than Once After Using The GoToAndStop function
I'm having a strange issue, and I am sure it's due to my lack of knowledge about how classes fully work in Adobe AIR (Flash CC). I've created a login button that is connected to a function, and based on a set of conditions it will take you to a different frame with the GoToAndStop function. I've created a logout button that is suppose to take you "back" to the login frame (that has the login button) if you click the logout button using the GoToAndStop function. Up to this point, everything works until I try to click the Login button again, it does not do anything. It's like it does not even try to execute my class file anymore.
Does the class file only run at startup and never runs again, and if so, how can I create a section of code that is constantly monitoring what the user is doing no matter what frame you are on and no matter if I use the GoToAndStop function or not?
ThanksBased on your qyestion, I think I was wrong with my second guess.
When I want to create a button, what I do is draw a bitmap that looks like a button and then use a mouse event listener that looks for any part of the stage that is clicked. You would use the same code for touch as well. As3 will return the x.y. coordinate of the area that was clicked or touched. When the xy coordinate is known, if it corrseponds to the area where the button is, I code the appropriate response. Hence, I only use one event listener for all my buttons, as long as thet involve simple clicks or taps of the screen.
Good luck, Justin -
How can I have keyframes on one layer proceed while using the gotoAndStop function?
I have a Flash presentation that allows me to pair videos with the slides using a nice piece of ActionScript. The presentation advances to the slide on the next keyfram when the viweer clicks the "next button" and the video for that keyframe (on a separate layer) begins playing.
owever, I am now trying to pair two slides with the same video without having the video restart or requiring the viewer to click the"next slide button" I was hoping I could just turn the two slides into a video clip, convert it into a symbol and insert the symbol in place of the static slide, but nothing seems to happen. I'm wondering if the "gotoAndStop" function in the ActionScript is preventing it from playing.
Any thoughts on how I can have the presentation be controlled by the next and previous buttons most of the time, but have the exception of one slide that changes on its own? The relevant (I believe) code is below.
Thanks!
Julien
// FUNCTIONS AND LOGIC
function fl_prevSlide():void
if(slides_mc.currentFrame > 1)
slides_mc.gotoAndStop(slides_mc.currentFrame-1);
if(transitionOn == true)
fl_doTransition();
if(pageNumberOn == false)
slideNumber_txt.text = "";
} else {
slideNumber_txt.text = String(slides_mc.currentFrame + "/" + slides_mc.totalFrames);
function fl_nextSlide():void
if(slides_mc.currentFrame < slides_mc.totalFrames)
slides_mc.gotoAndStop(slides_mc.currentFrame+1);
if(transitionOn == true)
fl_doTransition();
if(pageNumberOn == false)
slideNumber_txt.text = "";
} else {
slideNumber_txt.text = String(slides_mc.currentFrame + "/" + slides_mc.totalFrames);Try this code. Replace FLVmovie with the instance name of your FLV & set the time to when the frames shoudshould advance.
import flash.events.Event;
this.addEventListener(Event.ENTER_FRAME, checkTime);
function checkTime(e:Event):void {
if (this.FLVmovie.playheadTime >= 15) // This is the playhead time in seconds
this.gotoAndStop("frame label or frame #");
this.removeEventListener(Event.ENTER_FRAME, checkTime); -
Use of DECODE function in Discoverer 3.1
Hi all,
Is there any better way of using DECODE in Discoverer 3.1, i dont want to use that function in my Discoverer User edition or Admin ed.
Many of my queries use the DECODE function.
Your help is greatly appreciated.If you created an instance of your time class that you called myTime
var myTime:Time = new Time(15,15,0);
and later you wanted another instance with the same time you could write
var myTime2:Time = myTime.clone()
It is just there for convienience and doesn't have anything much to do with MVC -
Using iPad mail program I have a draft of an email. I have attempted to "cancel" this and "delete draft" but the email stays on my screen. How can I exit this so that I can use other email functions?
Try closing the Mail app completely and see if it works properly when you re-open the app : from the home screen (i.e. not with the Mail app 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Mail app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
If that doesn't work also do a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot. -
How to use standard java functions in a XSLT mapping
Hi All,
I wish to use a standard java function in a XSLT mapping, The issue is either i am giving incorrect namespace which is used to invoke the function or the signature of the function call is incorrect, I have read all the links in http://help.sap.com, and i know <b> one can enhance a XSLT mapping by writing one's own java code and thereby using java standard functions </b>, but the requirement is such that i need to try and use java standard function in XSLT mapping itself.
Please refer to the sample code below:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:javamap="java:java.lang.String">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:variable name="input" select="Title">
<xsl:if test="function-available('javamap:toUpperCase')">
<xsl:value-of select="javamap:toUpperCase($input)"/>
</xsl:if>
Author:<xsl:value-of select="Author"/>
</xsl:template>
</xsl:stylesheet>
error encountered is: Illegal number or type of arguments.
please reply if you have tried a similar scenario in SAP XI.
Thanks & Regards,
VarunHi Varun,
First of all i want to tell you that as per the documentation you can only call the static function inside xslt mapping. Your toUpperCase method is a non static function.
What i am getting is that you have an element called Author and you want to convert its value into uppercase.
you can write your own user defined function which is static.
Signature of your java method :
public static string toUpperCase(String Author,Map inputparam)
try this xslt map.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:javamap="java:JavaProgram">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="Author">
<xsl:value-of select="//Author_name"/>
</xsl:param>
<xsl:param name="inputparam" />
<xsl:template match="/">
<Author>
<xsl:if test="function-available('javamap:toUpperCase')">
<xsl:value-of select="javamap:toUpperCase($Author,$inputparam)"/>
</xsl:if>
</Author>
</xsl:template>
</xsl:stylesheet>
Hope this will work.
Thanks and Regards
Vishal Kumar -
Derive found flag in SQL with where clause using TABLE(CAST function
Dear All,
Stored procedure listEmployees
==========================
CREATE OR REPLACE TYPE STRING_ARRAY AS VARRAY(8000) OF VARCHAR2(15);
empIdList STRING_ARRAY
countriesList STRING_ARRAY
SELECT EMP_ID, EMP_COUNTRY, EMP_NAME, FOUND_FLAG_
FROM EMPLOYEE WHERE
EMP_ID IN
(SELECT * FROM TABLE(CAST(empIdList AS STRING_ARRAY))
AND EMP_COUNTRY IN
(SELECT * FROM TABLE(CAST(countriesList AS STRING_ARRAY))
=================
I have a stored procedure which lists the employees using above simple query.
Here I am using table CAST function to find the list of employees in one go
instead of looping through each and every employee
Everything fine until requirements forced me to get the FOUND_FLAG as well.
Now I wanted derive the FOUND_FLAG by using rownum, rowid, decode functions
but I was not successful
Can you please suggest if there is any intelligent way to say weather the
row is found for given parameters in the where clause?
If not I may have to loop through each set of empIdList, countriesList
and find the values individually just to set a flag. In this approach I can’t use
the TABLE CAST function which is efficient I suppose.
Note that query STRING_ARRAY is an VARRAY. It is very big in size and this procedure
suppose to handle large sets of data.
Thanks In advance
Regards
Charan
Edited by: kmcharan on 03-Dec-2009 09:55
Edited by: kmcharan on 03-Dec-2009 09:55If your query returns results, you have found them... so your "FOUND" flag might be a constant,...
-
How to use the Table Function defined in package in OWB?
Hi,
I defined a table function in a package. I am trying to use that in owb using Table function operator. But I came to know that, owb R1 supports only standalone table functions.
Is there any other way to use the table function defined in a package. As like we create synonyms for functions, is there any other way to do this.
I tryed to create synonyms, it is created. But it is showing compilation error. Finally I found that, we can't create synonyms for functions which are defined in packages.
Any one can explain it, how to resolve this problem.
Thank you,
Regards
Gowtham Sen.Hi Marcos,
Thank you for reply.
OWB R1 supports stand alone table functions. Here what I mean is, the table fucntion which is not inculded in any package is a stand alone table function.
for example say sample_tbl_fn is a table function. It is defined as a function.It is a stand alone function. We call this fucntion as "samp_tbl_fn()";
For exampe say sample_pkg is a package. say a function is defined in a package.
then we call that function as sample_pkg.functionname(); This is not a stand alone function.
I hope you understand it.
owb supports stand alone functions.
Here I would like to know, is there any other way to use the functions which are defined in package. While I am trying to use those functions (which are defined in package -- giving the name as packagename.functionname) it is throwing an error "Invalid object name."
Here I would like know, is there any other way to use the table functions which are defined in a package.
Thank you,
Regards,
Gowtham Sen. -
How do I use the print function to output a numeric variable with a fixed amount of leading zeroes
I need to create an output from a T-SQL query that picks a numeric variable and uses the print function to output with leading zeroes if it is less than three characters long when converted to string. For example if the variable is 12 the output should
be 012 and if the variable is 3 the output should be 003.
Presently the syntax I am using is PRINT STR(@CLUSTER,3) . But if @CLUSTER which is numeric is less than three characters I get spaces in front.
Please help!>> I need to create an output from a T-SQL query .. <<
NO! NO! In RDBMS, we have a presentation layer that handles displays. We do not ever do it in the database. This is fundamental. But more than that, the purpose of PRINT is for debugging in T-SQL and never for output.
You are still writing 1960's COBOL or BASIC, but you want to to it in SQL. You probably picked the wrong data type (a numeric that should be a string) and are trying to repair your design error.
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
PS CS5 Extended on Windows
When trying to use the clone stamp and/or healing brush as soon as I move the cursor from the toolbar over to the image I get an exact copy of the existing layer that moves around the window with the movement of the clone stamp/healing brush. This just started tonight. What's causing this weird behaviour?What are the settings in Window > Clone Source?
-
I have an iPad mini, I am connected to my work wireless connection. My printer also is on the same wireless network, however I am not able to print to my airprint enabled printer through this wireless connection. Is there a way to direct connect to the printer via a cable ?
I am missing something here on the connection. I am thinking possibly a firewall here at work will not allow me to use the airprint function. Help ?There is no support for wired printing.
It is probably a firewall issue, possibly where all inbound communications are blocked. Since you're at work, I'd call your work IT department and find out from them what you can/can't do. -
Is there any way to use copy from function in cProject Project creation.
Hi,
Kinldy suggest if any one have idea to use copy from function in cProject while creating Project in cProject.
We have copy from function in our material creation and BOM, Is there any way to copy the old project and we can take the same for new project as a Paste entire structure.
Please share with me if you have any ideas for the same.
Thanls in advance for your help.
Thanks & Regards.
RajHi,
please see
[http://help.sap.com/saphelp_ppm50/helpdata/en/4a/6431a343946ba2e10000000a421937/frameset.htm|http://help.sap.com/saphelp_ppm50/helpdata/en/4a/6431a343946ba2e10000000a421937/frameset.htm]
there the third case ("Based on an operational project ...")
Kind regards,
Florian -
How can I use Seeburger java functions on SAP XI's user defined functions?
Hi All,
As my title implies; how can I use Seeburger java functions on SAP XI's user defined functions? I've tried searching over the net in tutorials regarding this topic but I failed to find one; can someone provide me information regarding my question? thanks very much.
best regards,
MikeHi Mike !
You should check your documentation about which java classes you need to reference in the "import" section of your UDF. And also deploy the java classes into the java stack or include them as a imported archive in integration repository...it should be stated in the seeburger documentation.
What kind of functions are you trying to use?
Regards,
Matias. -
I am currently away from my MAC and want to send an email through apple mail with the bcc functionality. I am using the cloud to get to my mail, however, I can't figure out how to use the BCC functionality, please help. Thanks!
Open your mail,
lower left corner click on settings,
go to composing and check BCC, save and your done
Maybe you are looking for
-
S11 flex Bluetooth headset no longer works with ios7
Unit connects but sound plays through iPhone or iPad. S11 is not available (even though connected) in Airplay Listing. If I hold down mute button SIRI come on through head set. If I tell SIRI to play play list the playlist plays but music still play
-
Hello -- I'm an American living in Ethiopa. I've just ordered a Lumia 710 and joined this group. Does Lumia have any GPS support in Ethiopia?
-
Concerned about recent change.
I'm an avid supporter of ITunes Music/downloads, and have been trying for years to get more variety listed from other countries (understand the obstacles, unwarranted, but another topic).. Long story short... I recently logged into to look at anythin
-
Hi All, If SAP ECC is on SAP HANA Database then SLT is not need , then how to bring tables into HANA Studio for Modeling Kindly reply ASAP. Thanks in Advance
-
HT2075 I wanna to change security questions for my apple account how I do it's
I Wanna to change the security questions for my Apple account how I do it