Function setting

I wrote a dozen of simular functions like below, the bolded word can be anything like velocity, scale, ect...
function velocityGen() {
    velocityArray.splice(0, velocityArray.length-1);
    for (var i:int = 0; i<count; i++) {
        velocity = Math.random() * velocityRandomConstant + velocityConstant;
        velocityArray.push(velocity);
so I tried to extract the "keyword" of those functions to make a new and global function to do such simular jobs,
function valueGen(target:String) {
    this[target+"Array"].splice(0, this[target+"Array"].length-1);
    for (var i:int = 0; i<duskCount; i++) {
        this[target] = Math.random() * this[target+"RandomConstant"]+ this[target+"Constant"];
        this[target+"Array"].push(this[target]);
valueGen(velocity);
valueGen(blahblahblah);
of course I failed, here is the error message:
Scene 1, Layer 'actions', Frame 1, Line 196    1067: Implicit coercion of a value of type Number to an unrelated type String.
line 196 is the line "valueGen(velocity);" on above
Could anyone provide a correct sample for me? thz a lot
(ps. also I would like to know somemore details of the usage of "this", thz again)

that's the reason the compiler complained.  but you needed that message because velocity is a variable name and very different from the string "velocity".  if velocity were a string:
var velocity:String="HI";
the compiler wouldn't complain but you wouldn't be happy with your function call using velocity instead of "velocity".

Similar Messages

  • Business Function Set: Enterprise AddOns in Solution Manager

    Hello
    For testing purposes I want to activate the Enterprise AddOn EA_PLM in transaction SFW5 inside a Solution Manager 4 installation but no Enterprise AddOn is available. Additionally there is only one Business Function Set called "telco reference pack" with two Business Functions. Do I have to set up something before I can active the Enterprise AddOns? I thought PLM is part of the Solution Manager 4 installation.

    Hello Marc,
    the Solution Manager consists "only" of an CRM-component, the SolMan component itself and the Netweaver 2004s platform. So no PLM (and no Enterprise AddOn) is available. SolMan coves some functionalities of Software Lifecycle Management, but does not include the PLM coding itself. For EA_PLM you need an ERP system.
    Best regards, Alexander

  • Javascript to JSP question...Can javascript function set session attributes

    hello,
    i have a web app that, on one of its pages, displays "tabbed pane" as an image map at the top (a la amazon.com). my problem is this: each "logical" page contains separate forms that all use the same javabean. in other words, imagine that the tabs represent an account maintenance web ui for an on-line record store. the first tab might be labeled "General," the second "Contact info," the third "Shipping Info." Each uses the same account bean and displays portions of its properties relevant to the tab at hand. what i want to do is allow a user to enter the account maintenance ui, update info on the first tab, click on tab two and have the request with the changes sent to a processing jsp. yet, since each "tab" is actually a separate URL to another page, how do i get the updated info on the first tabe without adding some sort of "SAVE" button on each tab. ive considered using javascript, but dont know how to get the request params out of the first tab whn i click on another tab. is it possible to include an "onClick" function in each URL that "grabs" the updated form fields off the preceeding tab? can a javacript function set session attributes in jsp?

    hello there,
    wow, you've created one big mammy-jammy tool.
    first, javascript cannot access, set values to the session, without having to post to another JSP. javascript is great for manipulating objects, layers, form values, etc.
    you have 2 issues [if i understand correctly]:
    1) you need to able to save user info for a specific tab without having to reloading the page.
    ---you can create a form for EACH of your tabs and POST all the information to a hidden IFRAME or LAYER for NN4. that hidden IFRAME / LAYER will load a JSP page which with all the parameters you posted to it. or you can build a FRAMESET and target that document["frame-name"].src with that same JSP.
    2) handling when the SAVE INFO action should happen: hence some javascript event handler: onMouseOver, onClick, etc
    ---i don't know the dynamics of your tabs, but if store which tab was clicked on last, then if the user clicks on some other tab, javascript can submit that FORM to a JSP [see condition above]
    you have an interesting tool. can i see?
    i hope i wasn't too confusing, but your problem is sooo interesting. =)
    -WJP

  • Loss style when overriding the function 'set data' for a TileList

    Hi!
    In a TileList, I set the itemRenderer for a components from
    where I override the function set data like in this example:
    but, by doing this, I'm loosing all the built-in CSS
    behavior. The onMouseOver effect the change the backgroundColor and
    the hand pointer. I try to set it programmatically but without
    success.
    An idea?
    Thank you

    "FlexBin" <[email protected]> wrote in
    message
    news:gdaj4r$noj$[email protected]..
    > Hi!
    >
    > In a TileList, I set the itemRenderer for a components
    from where I
    > override
    > the function set data like in this example:
    >
    > but, by doing this, I'm loosing all the built-in CSS
    behavior. The
    > onMouseOver
    > effect the change the backgroundColor and the hand
    pointer. I try to set
    > it
    > programmatically but without success.
    >
    > An idea?
    >
    > Thank you
    >
    > public override function set data(value:Object):void
    > {
    > var xml:XML = new XML(value);
    >
    > if(this.backgroundIconName != null &&
    > this.ico != null &&
    > this.labelText != null) {
    >
    > if(xml.backgroundIconName != "") {
    >
    > this.backgroundIconName.source = "assets/" +
    xml.backgroundIconName;
    > }
    >
    > this.backgroundIconName.visible =
    (xml.backgroundIconName != "");
    >
    > this.ico.source = "assets/" + xml.iconName;
    > this.ico.width = Number(xml.width);
    > this.ico.height = Number(xml.height);
    >
    > this.labelText.text =
    resourceManager.getString('myResources',
    > xml.label);
    > }
    >
    > if(xml.@available == 'false')
    > {
    > this.enabled = false;
    > }
    > }
    There are examples of how to properly implement this kind of
    functionality
    in the itemRenderers here:
    http://flexdiary.blogspot.com/2008/09/groupingcollection-example-featuring.html
    http://flexdiary.blogspot.com/2008/09/extended-datagrid-with-stylefunction.html

  • How to activate Function Set

    Hi Guys,
    I want to activate Function set SAP Retail (EA-Retail) in my SAP IDES 2005 SR2 (700) box.
    Is it done through EWF5.
    Can someone give me correct procedure.
    Thanks in advance!

    You can do it in Client 000 with user having sap_all . Pleas logoff all other users .
    Thanks
    Prince Jose

  • SFW5 in IDES: business function set not selectable

    I intended to activate some IS solution using SFW5. My system is IDES 6.0 SR2 and client is 800.
    However, inside SFW5, I could not select other business function set to activate like in other production system.
    Please tell me why and how to do.
    Giang

    Hi Giang
    IDES solution for ERP 6.0 is preactivated is FI-CAX component and you cannot activate any other IS functionality if FI-CAX is activated. Please refer SAP note 1013391 for ERP 6.0 SR2.
    If you want a particular IS to be activated, SAP has release IDES for specific IS solutions. Following IDES solutions are avialable as of now:
    IDES DI/MILL PRODUCTS 2009
    IDES EA-DFPS 6.03
    IDES IS-CWM 6.03
    IDES IS-PS-CA 600
    IDES OIL-600
    IDES RETAIL-600
    IDES SAP AFS 6.0
    IDES SEM-BW 6.0/7.00
    Check if it does have your required component. Hope this helps you.
    Regards
    Rahul

  • SFW5: business function set not selectable

    I would like to activate PSCD.
    However, even in change mode, I could not select public sector business function set to activate.
    The system only display Contract AR + AP in one tab, and  Enterprise Add-on on another tab.
    Giang

    Hi Truong Giang,
    Try the following steps to activate PSCD and see whether it works out or not. I believe that you are using ECC 6.0 because till ECC 5.0 this SFW5 TCOde is not available.
    1. Execute the TCode - SFW5
    2. Select the Menu path Environment -> Business Function
    3. Under Business Function Column select either PSCD / PSCD_GRANTOR / PSCD_SETTINGS / PSCD_TRM according to your requirement
    4. Select Activate present on the Application toolbar or Press Ctrl+F3 or follow the menu path Business Function -> Activate
    Hope this solves your problem. Reward accordingly.
    Thanks and Regards,
    Maddineni Bharath.

  • Calling functions / setting variables in loaded SWF

    You know how you can create a Movieclip object, add a
    function or variable to it, then call that function or change that
    variable from within the SWF that includes it? I wanna be able to
    do that, only with SWFs that are loaded at run time.
    My "main" SWF is simply a menu-type thing. The user clicks a
    button in my MAIN.SWF, and the MAIN.SWF then loads the SWF that's
    associated with that button, using the AS 3.0 prescribed
    Loader()-URLRequest()-addChild() method that everyone always asks
    about.
    This works great. But now I've got some custom objects and
    such (ie., not just strings) within my MAIN.SWF that I'd like to be
    able to share with the loaded SWFs. Preferably, I'd like to use an
    accessor-type function (ie.,
    LoadedSWF.GiveMeTheCoolObject(MyCoolObject);), though at this point
    I'm willing to hack into the object itself (ie.,
    LoadedSWF.CoolObject.CoolField = MyCoolObject.CoolField;) if that's
    what it takes.
    I've tried just calling the functions and setting the fields,
    but the AS 3.0 compiler doesn't care for that sort of nonsense on
    it's generically-defined objects. Notice also that, at run time, a
    call to LoadedSWF.hasOwnObject("GiveMeTheCoolObject") returns true.
    So my big-brained colleagues, what's the magic?
    In advance, thanks for the help!
    Scott

    Kglad,
    quote:
    Originally posted by:
    kglad
    from that error message it appears your function is expecting
    a member of the MyCoolObject class, correct?
    and MyCoolObject is not an instance of that class. so, you
    need to fix that. ie, create a member of that class and use that
    class member as the function parameter.
    Heh, that's what the error message says all right. But the
    object actually IS a MyCoolObject class object. I stared at this
    thing for hours, and MyCoolObject IS an instance of that class. I
    tried various casting combinations (including casting it to an
    Object and passing that) but had no luck whatsoever.
    So I googled this particular runtime error message ("Error
    #1034: Type Coercion failed: cannot convert ") and found a ton of
    links to other people having a similar issue. Typically, the
    problem was just as you said, someone passing a button as a string,
    that kinda thing. But one guy had a problem with an object he
    derived from the Event class. After hours spent trying to get it to
    work, he tried overriding the base class' clone() method and got it
    to work:
    http://www.asserttrue.com/articles/2006/10/14/custom-events-in-actionscript-3-0
    As for my project, I took a long hard look at the overall
    architecture of my project and decided that it was best if all the
    "real work" took place in the MAIN.SWF file. This approach would
    solve a couple of other problems, and it just makes sense in a
    "separate the display from the data" mentality.
    So (and this is the interesting part) I changed the API for
    the LOADED.SWF to accept String pairs (ie.,
    LoadedSWF.AddToDisplay(Name:String, Data:String) ) instead of
    accepting MyCoolObj. Ran it, and Viola, now we're working without
    any run time exceptions. After that glorious moment, I created a
    couple of other APIs that just accepted base classes (one an int
    type, the other a function type) and was happily on my way.
    From this, I gather that passing non-base class (ie, derived
    class) objects to loaded MovieClips via custom function APIs is...
    maybe not as straightforward as we'd expect. In the grand scheme of
    things though, not a big deal: As far as I'm concerned AS3 rocks.
    Again Kglad, thanks for all the help: Your input on how to do
    this was the big push that I needed to get over the last technical
    hurdle of this project.
    To those who are reading this topic for the "how do I call
    functions and/or set variables in a loaded SWF?"
    The short answer is to cast the loaded SWF's content object
    as a MovieClip and then call the function or alter the variable:
    //Load the SWF (you've seen this code a million times)
    var LoadedSWFObj:Loader = new Loader();
    var MyURL:URLRequest = new URLRequest("LoadThisSWF.SWF");
    LoadedSWFObj.load(MyURL);
    //This is within your Event.COMPLETE handler:
    //Cast it as a MovieClip object and work with that.
    var LoadedSWF:MovieClip = LoadedSWFObj.content as MovieClip;
    // or another way to cast it is:
    var LoadedSWF:MovieClip = MovieClip(LoadedSWFObj.content);
    //Call yer function:
    LoadedSWF.CallMe();

  • Help with bash function(set background=dark/light in vimrc)

    I couldn't find any gvimrc files so I guess it uses the regular one. And since I work pretty much in X too  I thought it would be nice with a function that sets background=light if I'm in X an background=dark if not. Is that possible?
    /Richard

    vimrc configuration is not the same as bash.
    You probably want something like this in your ~/.vimrc:
    if has('gui_running')
    set background=light
    else
    set background = dark
    endif

  • Flex override public function set data

    Hi,
    I have a datagrid with itemRenderer in datagridcolumn as my custom component(c1). I am getting the dataprovider data in custom component by overriding the set data function, it is fine. But now my custom component(c1) is also having another custom component(c2).
    Now the doubt is - how to get the dataprovider data in c2 component?
    Thanks in advance.

    Create a property with name custom_data in component c2
    set the value of  _customData in c2 object created in c1 with the data u get in c1 in commitProperties method of c1.
    c2.customData = this.data;

  • How to make sure override public function set data(item:Object) is called on vertical scroll

    Hi
    I am facing an issue with my datagrid with renderers on all its columns.I need to enable or disable the render components based on values in different columns in the row.Its works fine in most of the places .But in some places which is not visible without the scroll,it seems the set data function is not called,because of which the component will be enabled when it has to be disabled.How do i ensure it works fine all the time.
    Regards
    Sidd

    The set data is probably being called.   Keep in mind that renderers are recycled so the enabled/disabled state must be fully derived from the row's data.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Partner function setting in purchasing document

    why we do partner function settings in purchasing document, like if we don't do this or if we do this then what would be the impact?
    plz tell me in your words

    Hi,
    Partner function is 'one vendor performs different functions with different divisions'.
    Example: Take SAIL-Steel authority of India.If you want to purchase material from SAIL you will be ordering that to the marketing department of SAIL.Material is supplied to you by the sales depot of SAIL.And the invoice is raised by the finance department.Here the main vendor is SAIL and the different divisions are the partners for the vendor SAIL.
    In SAP these are termed as partner functions.OA-ordering address,GS-goods supplier,IV-invoicing party etc.
    If this process is applicable then you have to use the partner functions in the purchase order.
    Regards,
    Rambhupal reddy

  • HT201263 Where can I find the "stay Awake" function setting?

    I love this function to kep my phone screen on regardless the time of dimming .
    I am looking for the very nice function "stay awake". but cant find it in the settings.
    help?

    doing Settings>General>Auto-Lock>Never, how long time it take the screen to go to go blank?

  • Business Function Set

    Can some one tell where to find or any document, what functionalities are offered under each business fucntion set ..like DIMP_SDUD.

    Hi ,
    Following link may help you
    http://help.sap.com/saphelp_nw70/helpdata/EN/de/899442047b0831e10000000a1550b0/content.htm
    Rahul.

  • Problem overloading "set data" function on Button DataGrid Renderer

    Hi all, I'm hoping this is something simple.
    I have a class that extends mx.controls.Button and implements mx.core.IDataRenderer.  I need to set the button icon whenever the Data property is set from the DataGrid.  My problem is that my overloaded set/get Data function are never called (I've stepped through the code in debug).  Instead the set/get functions in Container.as (Flex 3.4 SDK) get called.
    Here's the basics code:
    exportButtonRenderer.as
    package controls
        import flash.events.Event;
        import flash.events.MouseEvent;
        import mx.controls.Button;   
        import mx.core.IDataRenderer;
        import mx.controls.dataGridClasses.DataGridListData;   
        import mx.controls.listClasses.BaseListData;
        import mx.events.FlexEvent;
        import mx.controls.Alert;
        import model.descriptors.compDescriptor;
        import events.exportClickedEvent;   
        public class exportButtonRenderer extends Button implements IDataRenderer   
            //    embed your icons
            [Embed(source='/assets/icons/export.png')]
            [Bindable]
            public static var imageExport:Class;
            [Embed(source='/assets/icons/blank.png')]
            [Bindable]
            public static var imageBlank:Class;
            public function exportButtonRenderer()
                super();
            private var _listData:DataGridListData;
            override public function get listData():BaseListData
                return _listData;
            override public function set listData(value:BaseListData):void
                _listData = DataGridListData(value);
            private var _data:Object;       
            override public function get data():Object
                return _data;
            override public function set data(value:Object):void
                _data = value;
            override protected function clickHandler(event:MouseEvent):void
                super.clickHandler(event);   
    Now I know I'm using the Flexlib TreeGrid and not a standard DataGrid but when I trace through all the code all code firing the set/get functions is coming from the DataGrid anyway.
    Here's the my Grid def in my main app mxml:
    Header 1
    <flexlib:TreeGrid
            id="MKTXGrid"
            dragEnabled="false" sortableColumns="false" showRoot="false"
            disclosureClosedIcon="@Embed(source='/assets/icons/arrow_right.png')"
            disclosureOpenIcon="@Embed(source='/assets/icons/arrow_down.png')"
            folderOpenIcon="@Embed(source='/assets/icons/psd.png')"
            folderClosedIcon="@Embed(source='/assets/icons/psd.png')"       
            click="MKTXGrid_clickHandler(event)"
             doubleClickEnabled="true" doubleClick="MKTXGrid_doubleClickHandler(event)" left="0" right="0" top="0" bottom="16">
        <flexlib:columns>
                <flexlib:TreeGridColumn dataField="Name" headerText = "Name" minWidth="200" width="200" editable="true"/>
                <mx:DataGridColumn dataField="ExportName" headerText = "Export Name"/>
                <mx:DataGridColumn dataField="Export" headerText = "Export" width="50" minWidth="20" resizable="false">
                 <mx:itemRenderer>
                    <mx:Component>
                        <mx:Box horizontalAlign="center" width="100%" verticalScrollPolicy="off" horizontalScrollPolicy="off">
                            <controls:exportButtonRenderer label="Export" icon="@Embed(source='assets/icons/export.png')" width="12" height="12" useHandCursor="true">                        
                                <controls:click>
                                    <![CDATA[
                                        import events.exportClickedEvent;
                                        var e:exportClickedEvent = new exportClickedEvent();
                                        e.itemData = data;
                                        dispatchEvent(e);
                                    ]]>
                                </controls:click>
                            </controls:exportButtonRenderer>
                        </mx:Box>
                    </mx:Component>
                </mx:itemRenderer>
                </mx:DataGridColumn>
            </flexlib:columns>
        </flexlib:TreeGrid>
    Nothing too special going on.
    I know this can be done, I've seen examples in the SDK:
    http://opensource.adobe.com/svn/opensource/durango/trunk/ExternalFlexTools/com/dougmccune/ containers/accordionClasses/AccordionHeader.as
    By the way I've stepped through the code of the TreeGridItemRenderer class in Flexlib which works correctly and the class def starts like this:
    TreeGridItemRenderer.as
    import flash.display.DisplayObject;
    import flash.display.InteractiveObject;
    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.geom.Point;
    import flash.geom.Rectangle;
    import flexlib.controls.TreeGrid;
    import mx.controls.Image;
    import mx.controls.dataGridClasses.DataGridListData;
    import mx.controls.listClasses.BaseListData;
    import mx.controls.listClasses.IDropInListItemRenderer;
    import mx.controls.listClasses.IListItemRenderer;
    import mx.core.IDataRenderer;
    import mx.core.IFlexDisplayObject;
    import mx.core.IToolTip;
    import mx.core.SpriteAsset;
    import mx.core.UIComponent;
    import mx.core.UITextField;
    import mx.events.FlexEvent;
    import mx.events.ToolTipEvent;
    import mx.events.TreeEvent;
    import mx.managers.ILayoutManagerClient;
    import mx.styles.IStyleClient;
    public class TreeGridItemRenderer extends UIComponent
                                      implements IDataRenderer,
                                                   IDropInListItemRenderer,
                                                 ILayoutManagerClient,
                                                   IListItemRenderer
    Any help would be great!

    That's because you put your component in a Box.  The DataGrid is setting the Box's .data property and no code is setting the one on your component.  You shouldn't really need Box.  You can override updateDisplayList to center your Button instead.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

Maybe you are looking for

  • Performance tuning in CRM server

    Hi everyone,    My CRM server working very slow. Idont know the exact reason. My server configuration IBM Xeon processor 3 Ghz 3GB RAM.There are about 25 users. Is this problem with SAP or Hardware.If any one have performance tuning document plz post

  • Transferring Cash account to PCA in Classic PCA

    Hi Is is possible to transfer cash account to Profit Centers in Classic PCA.  If i have the following entry : DR        Primary Cost Element CR        Cash Can i transfer the Cash a/c to PCA based on the Primary Cost element.  If yes, what are the co

  • In the report we have to display DAY DESCRIPTION(Ex:Monday,Sunday,...)

    In the report we have to display DAY DESCRIPTION(Ex:Monday,Sunday,...)in  columns. How to get it? Can anyone help me? Thanks in Advance

  • ECC  6.0  release date

    Hello, Apologize me if this belong to another forum.   When ECC 6.0 was released to the public? Need to find the official info, Edited by: unJoss on Apr 1, 2009 4:42 PM

  • Cannot connect iChat to PC Webcam

    I know this seems to be a common problem but it is driving me up the wall. I have a G5 iMac 24" with built in iSight and my brother (in Ireland) has a Logitech webcam installed. We have both set up AIM accounts and can text live online etc but when w