Dynamic Variable Naming for Sound Object
Is it possible to dynamically name a variable? I'd like to
create a new Sound Object on the fly, so that I can use the
Sound.load() method multiple times. I would simply like to create
and name the variable and add a number to the end of the name
(i.e.; var "audio_1":Sound). I'm sure that this is possible.
However, I can't seem to get it figured out.
This code worked great! However, how can I set a global
variable equal to the newly created Sound Object so that it is
available globally via a reuseable reference?
Here's an example of how I attempted to do this. Please note:
audioObject is a global variable that I am trying to use to
reference the new Sound Object in various places.
audioObjectCount is a global variable that I am using to set
or get the next number to use when dynamically creating the next
new Sound Object
Similar Messages
-
can you create a variable and name it dynamically? like:
for(var i:Number = 0; i<5; i++){
var ["v"+i]:Number = i;
so you could create unique variables on the fly?Yes, but you need to define the scope of the variables:
for(var i:Number = 0; i<5; i++){
this["v"+i]:Number = i;
Because this uses the array access operator (square
brackets), it needs an object instance, like 'this', '_root' or
whatever fits.
cheers,
blemmo -
Dynamic file naming for two or more files in same mappin
Hello,
I am working with Dynamic file naming on receiver files...
Here two files are coming as output files...
I am using JAva UDF to handle the two file name....
But one one file is formed and another is missing as its 505 file aleady existing error is coming in Receivr Communication channel monitoring...
How to name different dynamic names for the two differenet filesHi Sunil,
Go thru this blog:
The specified item was not found.
Use this Variable Substitution method as an alternative option:
http://help.sap.com/saphelp_nw2004s/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/frameset.htm
SAP NetWeaver XI: Variable Substitution with Adapter-Specific Message Attributes via DynamicConfigurationBean
OR
The specified item was not found.
Regards,
Vinod. -
Dynamic variable Time for Select
Hi,
I try to develop some scripts but always I have the same problem , when I try to put in a Select instruction the variable Time, it doesn´t work correctly (for example):
*SELECT(%example%,"ID","TIME","[ID]='%TIME_SET%' ")
It doesn´t read correctly the variable Time_Set.
Have you got any idea to try to do selects using dynamic variable?
Thanks for all.Hi,
Dynamic variables like %TIME_SET% do not interact very well with the compiled default logic (LGX files) when it is run after a data send. If you look at the Default.LGX file, you will notice that your *SELECT statement does not appear there because that *SELECT statement has already been compiled. That is why the logic works when it is run via the debugger (because the LGF file is getting executed at run time) and it does not work when it is run via a data send (because the LGX is being executed).
What you will need to do is:
1. Create a another logic file (for example: Calculation1.LGF) and copy the text from the Default.LGF to this new logic file.
2. Place the following text in the Default.LGF file:
*RUNLOGIC
*LOGIC=Calculation1.LGF
*ENDRUNLOGIC
3. Validate and save the Default.LGF file
Now try running the logic after a data send and see if that works.
Good luck,
John -
Dynamic variables' naming from SendAndLoad
Hello,
Been chasing my tail for almost 2days now, I'm having
problems on how to load dynamically named variables and place it on
dynamically named movieclips. I'm loading variables from php/mysql
query thru sendAndLoad (no problem with that). The loaded variables
are names of swf files that i'm trying to load on dynamically
numbered movieclips. The problem is it just wont load. I've
searched the net for similar codes, but with no luck. I'm guessing
that my error is in getting the exact variable name to load.
Heylp...No problems, you're welcome.
I think the eval should do the same thing as what I had. I
can't remember, I don't tend to use eval in flash - don't really
know why. I think loadMovie also accepts a string argument (which I
assume it 'evals') for a target in which case it may also work
without the eval and just with ,"_root.my_movieclip" + i; (didn't
try it so don't know for sure).
Good luck with it. -
Dynamic Variable name (for int/long) from a String variable
Hi,
I want to give a int/long variable name from a String.
for ex.
String str = lookup + "Id";
lookup is a String variable coming from XML. Now, for instance lookup="name". So str = "nameId".
Now I want to create a int/long variable by nameId.
Could anybody tell me the way how to do. Please don't tell to use MAP.
Edited by: Shah on Dec 5, 2007 3:26 PMWell you can't. Use a Map.
The compiler translates variable names into slot numbers, either within an object or withing the local "stack frame" and these slot numbers are assigned names at compile time. No new slots can be created at run time. Java is not Basic.
Reflection allows you to find existing field names and methods (not local variables), so it's possible to map, for example, XML attribute names to field names or setters in an object but the names have to be known at compile time. -
Need help generating variable name for timeout object
Below is a function I am using to scale an object down and
then hide it. It works fine on just one object, but if I try to run
it on multiple objects at the same time, only the last object gets
scaled down. I believe this is because the timeout list only ever
has a single item in it, “ShrinkTimeOut”.
Does each entity in the timeout list need a distinct name?
And if so, how would I dynamically generate a name and save it so I
can kill the timeout object once the object has scaled down fully?> Does it look like I am getting rid of the timeout object
properly in my code?
Now that you mention it, and I have a look, no - it doesn't:
//not sure of the order of parameters here:
function fShrinkLoop(mModel, aTimeout) {
//Creates a variable that contains the vector value of the
model's
scale (vector( 1.0000, 1.0000, 1.0000 )).
nScaleVector = mModel.getPropRef("transform").scale;
//Checks to see if the model is 1% or less than its original
size.
if (nScaleVector[1]<=0.01) {
//Makes the model invisible.
mModel.visibility = symbol("none");
//Kills the timeout object.
aTimeout.forget();
} else {
//If it is not, we scale the model down further and allow
the loop to
repeat.
mModel.scale(0.9); -
Dynamic file naming for 820 outbound transaction
Hi All,
We have a requirement to set the file name of outbound 820 based on few fields of xml payload from the backend BPEL process. We are currently implementing batching by sending the action name in (jca.jms.JMSProperty.ACTION_NAME) property.We are using SFTP and B2b 11.1.1.6. I've referenced the following http://www.oracle.com/technetwork/middleware/b2b-integrations/learnmore/tnb2b11g002-326857.pdf
. Please share your thoughts.
Thanks in advance!!For batching scenario's filename passed from back-end is not considered. For batching scenarios, you have to provide the "Filename Format" in your partner channel configuration and at runtime B2B will automatically generate the filename accordingly. If you are working with AS2 then you may find "Filename Format" setting under "Exchange Protocol Parameters" of your AS2 channel (starting from 11.1.1.6.0). Filename format can be specifid using any one or all of below parameters -
%FROM_PARTY%
%TO_PARTY%
%DOCTYPE_NAME%
%DOCTYPE_REVISION%
%MSG_ID%
%TIMESTAMP%
%MSG_TYPE%
%INREPLYTO_MSG_ID%
If you are working with 11.1.1.5.0 or lower versions of 11g then please raise a SR with Oracle Support to get an appropriate patch for providing filename format in AS2 channel configuration.
For FILE/FTP/SFTP protocols, filename format setting is available in all 11g versions.
Regards,
Anuj -
Very odd behavior regarding variable naming with DataService.fill()
I'm experiencing this odd behavior in LCDS 2.5, wich pertains
to variable naming for the objects returned by a DataService.fill()
call. I ceated a simple destination with a Java adapter. the Server
side Java data object is defined as follows)
package test;
public class RepositoryObject
private String m_strObjectId;
private boolean m_bIsValid;
private long m_lSize;
[public setters and getters here]
On Flex side, the ActionScript value object is defined as
follows:
package test
[Bindable]
[RemoteClass(alias="test.RepositoryObject")]
public class RepositoryObject
public var m_strObjectId:String;
public var m_bIsValid:Boolean;
public var m_lSize:Number;
public function RepositoryObject()
The FDS destination definition (in
data-management-config.xml):
<destination id="testDs">
<adapter ref="java-dao" />
<properties>
<source>test.TestDS</source>
<scope>application</scope>
<metadata>
<identity property="m_strObjectId"/>
</metadata>
<network>
<session-timeout>20</session-timeout>
<paging enabled="false" pageSize="10" />
<throttle-inbound policy="ERROR" max-frequency="500"/>
<throttle-outbound policy="REPLACE"
max-frequency="500"/>
</network>
<server>
<fill-method>
<name>getObjects</name>
</fill-method>
</server>
</properties>
</destination>
What I figured while debugging into the client was is the
data returned by the service (I'm using the mx:DataService call)
returns objects whose variable names
do not match my definition:
m_strObjectId becomes objectId
m_lSize becomes size
m_bIsValid becomes isValid
I wonder why that renaming??? Basically "m_str" prefix was
stripped and capital "O" became lower case "o" for my first
variable etc.
For instance, in a datagrid cell renderer I could not
reference the returned value as {data.m_strObjectId}, but if I use
{data.objectId}, it works.
Any ideas why this behavior (which I found confusing and odd)
would be greately appreciated.
RobertThe latter, as "getM_strObjectId " is an ugly name... don't
tell me that causes issue...ok kidding, I got you. The
setter/getter names are important in this context.
Thanks a lot.
Robert -
Okay, I just need to figure out how to make dynamic variable
names. In this case, I have a loop, and inside the loop I need to
create a new array for every iteration of the loop. Something like
<cfloop from="0" to="10" index="i">
<cfset LoopArray#i# = Some Value>
</cfloop>
But that doesn't work. How can you make dynamic variable
named? I think it's probably something to do with evaluate or DE,
but I don't know how to use them, and the livedocs make no sense to
me. Thanks!On Thu, 22 May 2008 17:14:42 +0000 (UTC), kenji776 wrote:
> Thank you both for your replied, I did manage to find a
solution (the same one
> posted by JR "Bob" Dobbs). Pretty much just looks
like...
>
>
> <cfloop from="1" to="3" index="i">
> <cfset LinkResults["#i#"][1] = "Player 1's Move
ID">
> <cfset LinkResults["#i#"][2] = "Player 2's Move
ID">
> <cfset LinkResults["#i#"][3] = "Damage to player
1">
> <cfset LinkResults["#i#"][4] = "Damage to player
2">
> </cfloop>
From your values, you don't want a two-dimensional array
(which although
you're actually building LinkResults as a struct, with the
sequential
numeric keys, it's basically an array), you want an array of
structs, eg:
LinkResults
.player1.moveId
LinkResults.player1.damage
What is "i" actually counting through? IE: from 1-3 things...
which are...
what?
Adam -
Dynamic variable names and invalid_character_err
I'm neither an expert at structure notation nor dynamic
variable naming conventions and would appreciate any help with the
following. Thanks!
This code works fine.
<cfset idx="123">
<cfset form.product[idx]=StructNew()>
<cfparam name="form.product[idx].product_nm"
default="Raspberry Jam">
<cfform name="data_entry" method="post" format="flash"
height="525" width="675" action="formdump.cfm">
<cfformgroup type="tabnavigator" height="400"
width="650">
<cfformgroup type="page" label="Product #idx#">
<cfinput name="static_form_name" type="text"
label="Product" value="#form.product[idx].product_nm#" height="350"
width="600" readonly="yes">
</cfformgroup>
</cfformgroup>
</cfform>
The following code results in the following error:
"ORG.W3C.DOM.DOMEXCEPTION ERROR. Message: INVALID_CHARACTER_ERR: An
invalid or illegal XML character is specified." The only change is
in the "name" attribute of the <cfinput> tag:
<cfset idx="123">
<cfset form.product[idx]=StructNew()>
<cfparam name="form.product[idx].product_nm"
default="Raspberry Jam">
<cfform name="data_entry" method="post" format="flash"
height="525" width="675" action="formdump.cfm">
<cfformgroup type="tabnavigator" height="400"
width="650">
<cfformgroup type="page" label="Product #idx#">
<!--- Change value of name attribute from
"static_form_name" to "product[idx].product_nm" --->
<cfinput name="product[idx].product_nm" type="text"
label="Product" value="#form.product[idx].product_nm#" height="350"
width="600" readonly="yes">
</cfformgroup>
</cfformgroup>
</cfform>
Pam Grieger
[email protected]Thanks for the info. Knowing what WON’T work is
helpful!
Here’s what I’m trying to do. I’m rewriting
one of my apps, switching out conventional HTML form controls for
<cfform> controls in Flash format. Many of the existing forms
in my app are for updating data contained in a central database.
When such a form is rendered to the screen, each form control is
pre-populated with existing data. All form controls are named
dynamically based upon the unique ID of the record being updated.
Here’s a streamlined but typical example:
<!--- User selected projects 14, 15, 16, and 17 for
update. Get existing project data. --->
<cfquery name="get_project_detail"
datasource="#application.DataSource#">
SELECT project_oid_nbr, project_nm
FROM project_table
WHERE project_oid_nbr IN (14,15,16,17)
ORDER BY project_oid_nbr
</cfquery>
<!--- Initialize the project_nm form control. Form names
are dynamic, based upon get_project_detail.project_oid_nbr. --->
<cfloop query="get_project_detail">
<cfparam name="form.project_nm_#project_oid_nbr#"
default="#get_project_detail.project_nm#">
</cfloop>
<!--- Create HTML form control. --->
<table>
<cfloop query="get_project_detail">
<tr>
<td>
<cfoutput>
Project #project_oid_nbr#:
<input type="text" name="project_nm_#project_oid_nbr#"
value="#Evaluate("form.project_nm_#project_oid_nbr#")#">
</cfoutput>
</td>
</tr>
</cfloop>
</table>
This has been working just fine. However, I’m wondering
if using the Evaluate() function is the most efficient way to go.
Therefore I wanted to use structure notation to avoid the
Evaluate() function, but as mentioned in my original post, this
naming convention won’t work with <cfform> tags.
Any suggestions as to the most efficient way to get the same
result while still using <cfform> tags? Thanks so much! -
Hi for all.
I'm need create a object with "dynamic" name. For example
Object ABCi = new ...
where i is a indice.
Please, help-me>
Object ABC[] = new Object [size];
for (int i=0; i<size;i++) {
ABC[i] = ....
}if you do something like this. How do you call one of the instances. How do you know how many there are??
>
Dynamic variable name? You're just making problems for
yourselfIs there a better way? Because sometimes you have to have something like the above. Why is it a big problem?
Thanks
Brian -
My Flash site has a media player which uses the attachSound
method to play and skip through 3 mp3s. As a result the preloader
shows up after the movie has loaded 60%. To rectify this, i changed
the Publish Settings under the Flash Tab so that the classes for AS
2.0 load in the 2nd frame of the Preloader Scene(I have separated
the preloader and the main movie to diffrerent scenes..)
I read it somewhere that to correct a similar problem with
MCs, you need to place them somewhere in the timeline (say,Off
Stage), But how can same be done for Sound Objects.???if i do that then the preloader works fine,however the player
doesnt work...since the audio files dont get loaded.. -
Using variable names for object names
Is there any way you can use a String variable to name an object? I.e., something like:
String name = "objectName";
\\ create an Image object named objectName
Image (name.valueOf()) = new Image();
This code obviously does not work, but I'm working on a map applet which uses a map composed of thousands of tiles, and then shows only a portion of the map by drawing the appropriate tiles into the window using the x/y coordinates and a nested for loop to determine which tiles to draw. However, unless I want to manually declare and then call each of these Image objects, I need to have a way to have the actual name of each image object be a reference to a variable, which I will then initalize according to the name of the tile I'm using. Does that make sense at all? Anyway, I was just wondering if anyone knows of any way to do this. Thanks.
-AriTypically this is done using a Collection, for example:
Image[] img = new Image[100];
for (int i=0; i<img.length;i++)
img[i] = new Image();... Sort of thing. -
Dynamic Variables and New-Object - in a GUI
so, i have not found anything that i can parlay into a solution for what i am attempting to do.
Basically i am using powershell to build a GUI to manage websites on various servers.
in a nutshell:
- i have an array with the servers i want to query
- a foreach loop gets me the site names for each server (number of sites can vary on a server).
- need put checkboxes on a GUI for every site to do something (25-30 sites across 8 servers).
currently i am passing the $dir.name variable to a function that will create the new variable using this command:
$pName = $dir.name New-variable -name $pName -value (New-Object System.Windows.Forms.CheckBox)
$pName.Location -value (New-Object System.Drawing.Size(10,$i))
$pName.Size -value (New-Object System.Drawing.Size(100,20))
$Pname.Text -value $dir.name
$groupBox.Controls.Add($pName)
Problem is i am not able to do anything with my newly created variable. I am trying to use the following code to position the new checkbox but i get nothing (same for text, size, etc.) I am not seeing any errors, so i don't know what i have going
wrong.
is this even possible?
I am able to create static checkboxes, and i can create dynamic variables. But i can't mix the two...Here is how we normally use listboxes to handle form situations like this one. The listboxes can automatically select subgroups.
The hash of arrays can be loaded very easily with a script or the results of the first list can be used to lookup and set the contents of the second.
Notice how little code is actually used. This is all of the setup code needed aside from the from definition:
$FormEvent_Load={
$global:serversToSites=@{
Server1=@('S1_SITE1','S1_SITE2','S1_SITE3')
Server2=@('S2_SITE1','S2_SITE2','S2_SITE3')
Server3=@('S3_SITE1','S3_SITE2','S3_SITE3')
$listbox1.Items.AddRange($serversToSites.Keys)
$listbox1_SelectedIndexChanged={
$listbox2.Items.Clear()
$listbox2.Items.AddRange($global:serversToSites[$listbox1.SelectedItem])
$listbox2_SelectedIndexChanged={
[void][System.Windows.Forms.MessageBox]::Show($listbox2.SelectedItem,'You Selected Site')
Here is the complete demo form:
[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
[System.Windows.Forms.Application]::EnableVisualStyles()
$form1 = New-Object 'System.Windows.Forms.Form'
$listbox2 = New-Object 'System.Windows.Forms.ListBox'
$listbox1 = New-Object 'System.Windows.Forms.ListBox'
$buttonOK = New-Object 'System.Windows.Forms.Button'
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
$FormEvent_Load={
$global:serversToSites=@{
Server1=@('S1_SITE1','S1_SITE2','S1_SITE3')
Server2=@('S2_SITE1','S2_SITE2','S2_SITE3')
Server3=@('S3_SITE1','S3_SITE2','S3_SITE3')
$listbox1.Items.AddRange($serversToSites.Keys)
$listbox1_SelectedIndexChanged={
$listbox2.Items.Clear()
$listbox2.Items.AddRange($global:serversToSites[$listbox1.SelectedItem])
$listbox2_SelectedIndexChanged={
[void][System.Windows.Forms.MessageBox]::Show($listbox2.SelectedItem,'You Selected Site')
$Form_StateCorrection_Load=
#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
$form1.Controls.Add($listbox2)
$form1.Controls.Add($listbox1)
$form1.Controls.Add($buttonOK)
$form1.AcceptButton = $buttonOK
$form1.ClientSize = '439, 262'
$form1.FormBorderStyle = 'FixedDialog'
$form1.MaximizeBox = $False
$form1.MinimizeBox = $False
$form1.Name = "form1"
$form1.StartPosition = 'CenterScreen'
$form1.Text = "Form"
$form1.add_Load($FormEvent_Load)
# listbox2
$listbox2.FormattingEnabled = $True
$listbox2.Location = '237, 26'
$listbox2.Name = "listbox2"
$listbox2.Size = '120, 134'
$listbox2.TabIndex = 2
$listbox2.add_SelectedIndexChanged($listbox2_SelectedIndexChanged)
# listbox1
$listbox1.FormattingEnabled = $True
$listbox1.Location = '13, 26'
$listbox1.Name = "listbox1"
$listbox1.Size = '120, 134'
$listbox1.TabIndex = 1
$listbox1.Sorted = $true
$listbox1.add_SelectedIndexChanged($listbox1_SelectedIndexChanged)
# buttonOK
$buttonOK.Anchor = 'Bottom, Right'
$buttonOK.DialogResult = 'OK'
$buttonOK.Location = '352, 227'
$buttonOK.Name = "buttonOK"
$buttonOK.Size = '75, 23'
$buttonOK.TabIndex = 0
$buttonOK.Text = "OK"
$buttonOK.UseVisualStyleBackColor = $True
#Save the initial state of the form
$InitialFormWindowState = $form1.WindowState
#Init the OnLoad event to correct the initial state of the form
$form1.add_Load($Form_StateCorrection_Load)
#Clean up the control events
$form1.add_FormClosed($Form_Cleanup_FormClosed)
#Show the Form
$form1.ShowDialog()
You can easily substitute CheckedListbox if you like checkboxes.
¯\_(ツ)_/¯
Maybe you are looking for
-
Catalog items visible to everyone, purchaseable only for some users
Hello everybody Me again trying to find a solution to the following problem: We need to have some items in our catalog that are visible for every user but only purchaseable via shopping cart / SRM for some authorized users. I couldn't find any possib
-
I am trying out the Premiere Elements but I am not sure I will want to continue to use it. First problem: How do I get the window to go to a smaller size? I click on the box on the upper right corner but it still covers the whole computer screen and
-
We need to print to an old Zebra 2746 using ZPL code inside a SAPScript. Unfortunately we can't find a way to do it (and we can't find a a driver specific for such printer). Does anyone use Zebra 2746? If yes, what kind of driver are you using? Thank
-
Hey friends ! Getting error in IDOC creation ! need help
After i execute the outbound IDOC report ! I am getting an error in the Status message as "error 26". I searched for thet in se16 and come to know that its aEDI syntax error. Can anyone tell Where are the defects and will be the approach to solve t
-
After resizing a photo and viewing in album picture offsets to one side and crashes ios7
After resizing a photo using the edit function , viewing the photo in camera roll Offsets the picture to one side so its not in the middle , zoom into the pic and zoom back out The black borders appear at the top and bottom and all looks in centre Bu