Set var in another symbol?
i have a button in a symbol, when i release the mouseclick, i
want it to add the value if 1 to a dyn. txt field in another
symbol... var name is "DYNTXTFIELD"
so, if i use:
var DYNTXTFIELD=DYNTXTFIELD+1;
nothing happens.
if i add the path to the variable, i get an error!
**Error** Symbol=Menu, layer=Buttons, frame=88:Line 9: Syntax
error.
var _root.Symbol.DYNTXTFIELD=root.Symbol.DYNTXTFIELD+1;
why would such a simple thing be so difficut for flash to do?
does anyone have any ideas how to get what i want to happen,
to happen? i cant find any documentation about this function, one
you would think would have come up often, thanks!
well, according to:
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_14727
"Declare variables with var or set variable. Although Flash
does not require using var or set variable to assign a value to a
variable, it's a good practice...."
Right, thats why it didnt work for me, what did work is :
_root.Symbol.DYNTXTFIELD=root.Symbol.DYNTXTFIELD+1;
notice, the lack of "var"? as suggested by adobe's own
documentation...
live and learn.
also, this topic posted twice, with no option to delete my
repeated post... why do you suppose that is?
Similar Messages
-
How to access a variable from inside another symbol
So i did this tutorial, Leveraging Independent Symbol Timelines created by Eliane...it's rockin, btw. ;-)
All's well but now i have a symbol on the stage called mc-home. inside of mc-home is a button called btn-go.
On the stage in composition ready there's a variable sym.setVariable("current", "mc-home");
This code works for a symbol that's on the stage but, how do i get this code to work on a button that's inside another symbol that's on the stage?
var current = sym.getVariable("current");
if (current != "") {
sym.getSymbol(current).play("OUT");
sym.getSymbol("mc-something").play("IN");
sym.setVariable("current", "mc-something");sorry, i was kind of confused myself too, don't worry about it but thanks for your patience for reading it anyway
-
Get the ID of a dynamically created symbol from library, INSIDE another symbol.
Hi everyone,
I'm trying to get the id from a dynamic created symbol from library.
When dynamically creating the symbol directly on the stage (or composition level), there's no problem.
But I just can't get it to work when creating the symbol inside another symbol.
Below some examples using both "getChildSymbols()" and "aSymbolInstances"
// USING "getChildSymbols()" /////////////////////////////////////////////////////////////////////////
// ON THE STAGE
var m_item = sym.createChildSymbol("m_item","Stage");
var symbolChildren = sym.getChildSymbols();
console.log(symbolChildren[0].getSymbolElement().attr('id')); // ok eid_1391853893203
// INSIDE ANOTHER SYMBOL
var m_item = sym.createChildSymbol("m_item", sym.getSymbol("holder").getSymbolElement());
var symbolChildren = sym.getSymbol("holder").getChildSymbols(); // Am i using this wrong maybe?
console.log(symbolChildren.length) // returns 0 so can't get no ID either
// USING "aSymbolInstances"" //////////////////////////////////////////////////////////////////////////
// ON THE STAGE
var m_item = sym.createChildSymbol("m_item","Stage");
console.log(sym.aSymbolInstances[0]); // ok (i guess) x.fn.x.init[1] 0: div#eid_1391854141436
// INSIDE ANOTHER SYMBOL
var m_item = sym.createChildSymbol("m_item", sym.getSymbol("holder").getSymbolElement());
console.log(sym.getSymbol("holder").aSymbolInstances[0]); // Javascript error in event handler! Event Type = element
In this post http://forums.adobe.com/message/5691824 is written: "mySym.aSymbolInstances will give you an array with all "names" when you create symbols"
Could it be this only works on the stage/ composition level only and not inside a symbol?
The following methods to achieve the same are indeed possible, but i simply DON'T want to use them in this case:
1) Storing a reference of the created symbol in an array and call it later by index.
2) Giving the items an ID manually on creation and use document.getElementById() afterwards.
I can't believe this isn't possible. I am probably missing something here.
Forgive me I am a newbie using Adobe Edge!
I really hope someone can help me out here.
Anyway, thnx in advance people!
Kind Regards,
Lester.Hi,
Thanks for the quick response!
True this is also a possibility. But this method is almost the same of "Giving the items an ID manually on creation and use document.getElementById() afterwards".
In this way (correct me if i'm wrong) you have to give it an unique ID yourself. In a (very) big project this isn't the most practical way.
Although I know it is possible.
Now when Edge creates a symbol dynamically on the Stage (or composition level) or inside another symbol it always gives the symbol an ID like "eid_1391853893203".
I want to reuse this (unique) ID given by Edge after creation.
If created on the stage directly you can get this ID very easy. Like this;
var m_item = sym.createChildSymbol("m_item","Stage");
var symbolChildren = sym.getChildSymbols();
console.log(symbolChildren[0].getSymbolElement().attr('id')); // ok eid_1391853893203
I want to do exactly the same when created INSIDE another symbol.
var m_item = sym.createChildSymbol("m_item", sym.getSymbol("holder").getSymbolElement());
Now how can I accomplish this? How can I get the Id of a dynamically created symbol INSIDE another symbol instead of created directly on the stage?
This is what i'm after.
Thnx in advance! -
What is the best way to delete dynamically-generated symbols from another symbol?
in the onClick handler for 1 symbol, I have:
var sandwhichQty1 = sym.createChildSymbol("sandQty1", "Stage");
another symbol inside sandQty1 has the onClick method:
this.deleteSymbol();
which works fine, deleting sandQty1. I'd like to delete it, and others, from another button, in the circumstance where users don't close them this way.
I notice that id and class are dynamically assigned to the child symbol, which makes it hard for me.
any ideas?Hi, I did it in this way, and functions well; maybe this is not the best way, but worked for me. Obviously this code is based on the elainafineell's correct solution.
This is my scenario:
In a Trigger @ xxxxms there is that:
var i = 1;
$.each(results, function(index, element)
var s = sym.createChildSymbol("mySymbol", "someContainer");
// some code here
// Creating the variable that save my new instance of mySymbol
sym.setVariable("var_id"+i, s);
i++;
// a global var, take care with the name
numOfInstances = i;
Then, in a click action of some button, symbol, anything that support an action, I code this:
sym.eraseSymInstance();
And, in the creationComplete, I code the function like this:
sym.eraseSymInstance = function()
for(var i = 1; i <= numOfInstances; i++)
var s = sym.getVariable("var_id"+i);
s.deleteSymbol();
For me function well.
I hope this can be usefull for somebody else. -
How can i reuse same variables that i create using c:set var="index" /
hi all,
please some one helpme!!!!!!
how can i reuse same variable that i create using
<c:set var="index" value="${0}"/>
cause later in the program i use index to do some condition and based on that i increment ...
so for example if i say...
<c:if test="${index==0}">
<c:set var="index" value="${index+1}"/>
</c:if>
will it be like
if(index==0)
index++;
can i do like i did be4. if not what do i need to do to reuse. cause i use the variable atleast 5 time and its keep changing on diff condition level.Have you tried it?
It should work, provided you are on the same page.
The c:set tag creates the variable in pageScope by default.
If you forward to another JSP you need to set the scope to be "request" so that it is still available. -
Trying to show() and play() a symbol from inside another symbol
Hi Everyone !
I'm running into a problem which is getting me crazy.
I have the following case :
- 1 symbol (_Page_Background) containing an animation with the following trigger @0s :
// Hiding the symbol
sym.getParentSymbol().$("_Page_Background").hide();
// Stop it
sym.stop();
- 1 element (B_TOYS), inside of a symbol (BUTTONS) with the following "click" trigger :
// Showing the _Page_Background symbol
sym.getComposition().getStage().getSymbol("_Page_Background").show();
// Start playing it
sym.getComposition().getStage().getSymbol("_Page_Background").play("INTRO");
The Symbol _Page_Background starts hidden, like it should. But when I click on the button (B_TOYS), nothing happens. Although, everything was working correctly before I turned my buttons into symbols ..
I guess the problems lies with the "show()" function, because I have other buttons that work properly but they don't show/hide anything, they just play()
Am I missing something ?!
Thanks in advance for your kind help !Hi Dimitri,
Think of symbols as independent timelines that can contain other elements, or instances of other symbols. The Stage/main timeline is a symbol as well. Scripting calls are scoped to the symbol that the script is in. The keyword sym stands for the symbol that you're in with the script.
So if your script is at the same level as what you are targeting with it:
Use sym.$("elementName") to access an element's properties
Use sym.getSymbol("symbolName") to access a symbol's timeline. If there's another symbol inside that symbol that you want to access, you'd use sym.getSymbol("symbolName").getSymbol("childSymbolName")...that's only two levels deep, but you can go as deep as needs be.
If you're trying to access an element in a symbol, you'd combine these two, such as sym.getSymbol("symbolName").$("elementName")
When your script is within a symbol and you want to access an element or symbol outside of the symbol timeline:
Use sym.getParent() to get to any elements that are in the parent symbol (the symbol which contains the symbol you're calling from), which could be the Stage or could be another parent symbol
Use sym.getComposition().getStage() from any symbol level to access things at the main Stage level. You can also dive into a symbol on the Stage from any symbol using sym.getComposition().getStage().getSymbol("symbolName").
All is explained in detail here:
http://www.adobe.com/devnet-docs/edgeanimate/api/current/index.html
hth,
Joe -
Can you print from an iPad 2 using 3G in a home with no other computer or wifi by using an iPhone 5 hot spot connection if the printer has been set up in another place with live wifi? I know this question is loaded but my dad lives in a rural area and is wanting a printer to use occasionally. He doesn't want to deal with a computer and I keep his iPad updated for him at my home. Please shed some light on this for us PLEASE. Thanks
In that case, it should be possible. I haven't tried this directly, but I believe it should work.
You'll need to get an actual AirPrint compatible Printer.
Check here for a list of Printers you can choose from.
http://support.apple.com/kb/ht4356
Once you have the compatible printer, using the Hotspot feature from the iPhone he'll have to create the Wifi bubble form the iPhone, and connect the Printer to that Wifi network.
Then connect the iPad to that same Wifi network provided by the iPhone. When all that is done, the printer should appear in any of the Apps that can Print under the Action Arrow button.
For instance in email, pressing the action arrow should show a Print option. In there the printer should appear.
Alternatively you can simply buy a wireless router and setup the network through there even if there is no internet attached. Connect the wireless printer to the router network, and connect the iPad or iPhone to that same wifi network to print. -
Can't subtract one var from another in js
I have a script which I'm modifying, it resizes an image, adds a black border then adds white borders to replicate the look of a 10x8 inch print.
This line is giving me trouble and I can't seee why!
docRef.resizeCanvas ( docRef.width + (portraitPrintW - docRef.width), docRef.height, AnchorPosition.MIDDLECENTER);
I've already set
var docRef = activeDocument; var portraitPrintW = 576;
The script has resized the image to 72ppi and to fit 676ppi long side. Its then added a 2px black border all around. At this point the image should be 454px wide. I want to add a white border to the left and right to give a total width of 576. So the above line should be 454 + (576-454) which is 454+126=576 therefore I'm doing a Resize Canvas 576, 680 (the current height) middle centre (with a white background - set as a var earlier).
What actually happens is the canvas is resized to be 334 wide (height is correct) - how did that happen?
Replacing a couple or vars with real number allows the script to work as expected
docRef.resizeCanvas ( (docRef.width + (576 - 450) ), docRef.height, AnchorPosition.MIDDLECENTER);
and
docRef.resizeCanvas ( (docRef.width + (portraitPrintW - 450) ), docRef.height, AnchorPosition.MIDDLECENTER);
also works as expected
Maybe I can't use the same var twice in a calculation, no because even this doesn't work
var currentWidth = docRef.width;
docRef.resizeCanvas ( (docRef.width + (portraitPrintW - currentWidth) ), docRef.height, AnchorPosition.MIDDLECENTER);
So why does ( docRef.width + (portraitPrintW - docRef.width) return 334, not 676?
Thanks for any clues.I think I'm already setting the ruler units to pixels, here I'm saving them to a var in order to reset them after the scrip is finished.
var strtRulerUnits = preferences.rulerUnits;
var strtTypeUnits = preferences.typeUnits;
preferences.rulerUnits = Units.PIXELS;
preferences.typeUnits = TypeUnits.PIXELS;
and that appears to be working. The calculation returns the expected answer when using numeric values in place of some vars, as I say:
docRef.resizeCanvas ( docRef.width + (portraitPrintW - docRef.width), docRef.height, AnchorPosition.MIDDLECENTER);
returns a different answer from
docRef.resizeCanvas ( (docRef.width + (576 - 450) ), docRef.height, AnchorPosition.MIDDLECENTER);
even though var portraitPrintW is set to 576 and docRef.width (should) be 450.
Thanks again. -
hey there, Kindly elaborate me the difference Between Set and Select clause while Providing value to a Variable or Even a Column.
Declare @var nvarchar(Max)
Set @var= (Select TestName+ cAst(TestId as nvarchar) from TblTest where TestID=1)
Insert into TblTest(TestName)
Values (@var)
Declare @var nvarchar(Max)
Select @var= (Select TestNAme + Cast(TestId as Nvarchar(MAx)) from TblTest Where TestID=1)
Insert into TblTest(TestName)
Values(@var)
Values and result I am getting is Same in Both.
But just wondering if there is any Difference. and if Any which Should I prefer.
And Which one uses less Resources.I like this article
http://vyaskn.tripod.com/differences_between_set_and_select.htm
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Set JTable in another JTable Column
Hai Java Experts
Can we Set JTable in another JTable Column
In jsp we add one table in a column of another table. Like the previous way can we do it in swing?
Pls Help me with example..
Thanks[http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#editrender]
db
edit And adding a table in a column of another table doesn't make any sense at all. Perhaps you meant showing a table in a cell of another table.
Edited by: DarrylBurke -
My ipod was orignally set up on an old pc which is now gone. When I want to update delete some old songs to make way for new ones' I can't seem to see the full listing of my ipod. It says it was set up on another device. How can I copy my current ipod onto my laptop. I can't run the risk of syncing it if it only keeps the new tracks I have added through using my laptop
There are multiple reasons that lead to issue. You should read the troubleshooting guide to get the right solution to solve the issue: iPhone, iPad, or iPod touch not recognized in iTunes for Windows - Apple Support
-
Switch symbols inside another symbol
hello!
I have a parent symbol (symbolA) that contain another symbol (symbolB). when I click on the inner symbolB, I want to make it switch with a third symbol (symbolC) always inside the symbolA
I can't find a solution yet
many thanks,
mirkoScope in Edge is the hardest. I just posted a sample that should help you.
http://forums.adobe.com/message/5675763#5675763
But for your case here it is:
sym.getSymbol('symbolA').$('symbolB').click(function(){
sym.getComposition().getStage().getSymbol('symbolA').$('symbolC).play();
or
sym.getSymbol('symbolA').$('symbolB').click(function(){
sym.getSymbol('symbolA').$('symbolC).play(); -
Control a symbol timeline from another symbol timeline on specific condition
Hi! I have 8 animated symbol that plays on clicking over them on the main stage and i want, for example, that if symbol 1 animation is complete and i click on symbol 3, symbol 3 plays forward and symbol 1 plays on reverse and vice versa just like this: http://www.framefarm.net/eugenio/edge/example/example.html
please help!I put together a Composition that I think does what you're asking. it's not elegant, but it works.
in the timeline of Symbol_1
place stop() triggers at the start and end
in the same triggers, set a Symbol variable that states whether the animation has finished i.e. sym.setVariable("isDone", "false");
place a trigger on the rectangle to play() or playReverse() depending on an if() statement about the variable
in the timeline of Symbol_3
place stop() triggers at the start and end
in the same triggers, set a Symbol variable that states whether the animation has finished i.e. sym.setVariable("isDone2", "false");
place a trigger on the rectangle to:
declare 2 new variables, which use sym.getVariable() to get isDone and isDone2 as above,
play() or playReverse() depending on an if() else if() else if() statement about both variables
I used the relative string to get the local variable and absolute string to get the variable from the other Symbol, i.e.
var myVariable = sym.getComposition().getStage().getSymbol("Symbol_1").getVariable("isDone");
var myVariable2 = sym.getVariable("isDone2");
I can send you the entire code if that helps. -
Why setting var in CFFUNCTION causes error
As far as my knowledge goes, the BEST practise when setting
local variable inside a CFFUNCTION is to use the word "var" in
front of the variable name, for example: <CFSET var
myVariable="whatever">
I'm doing it now and all I get is an error message saying:
Error invoking CFC name_of_cfc:local variable myVariable on
line 60 must be grouped at the top of the function body!
I'm using CF8 and I need to use cfswitch within the
cffunction, so when I do <cfcase value="SomeValue"><cfset
var myVariable="TheValue"></cfcase> etc I got that error.
When I tested with just CFSET var MyVariable="TheVariable"
with no cfswitch/cfcase I still get that error
when I took out the word "var" from cfset, I have no error, I
put these variables directly after my cfarguments. Does anyone know
why this is happening to me?
I thought if I don't use the "var" word for my variable set
within cffunction there will be possibilities when later on setting
up another variables outside this function and if the name happen
to be the same, will override each other and causing disaster to my
application.
Please help!!mega_L wrote:
> As far as my knowledge goes, the BEST practise when
setting local variable
> inside a CFFUNCTION is to use the word "var" in front of
the variable name, for
> example: <CFSET var myVariable="whatever">
Yes, this is the best practice to make the variable local to
the
function. But you only need to use the var keyword once when
you define
the variable. And you must define the local variables with
the var
keyword at the very beginning of the function body. The only
content
allowed before this happens are the argument definitions,
i.e. the
<cfargument ...> tags.
If you have a variable that you don't need to use, you just
need to
define it with a default and|or dummy value in the beginning
of the
function. Then you can set it's value appropriately later in
the
function when it is required. This is often done with query
tag return
variables.
I.E.
<cffunction name="myQryFunction"...>
<cfargument name="someArgument"...>
<cfset var localQry = "">
<cfquery name="localQry"...>
SQL
</cfquery>
<cfreturn localQery>
</cffunction>
Because of this necessity to define all local variables at
the beginning
of the function, a lot of developers use a standard where
they define a
local structure. They can then just append new keys and
values to this
local structure throughout the function. Personally I don't
see much
advantage to doing this, but to each his|her own.
I.E.
<cffunction name="myQryFunction"...>
<cfargument name="someArgument"...>
<cfset var local = structNew()>
<cfset local.something = "FooBar">
<cfreturn local.something>
</cffunction> -
ComboBox: How do I set Var?
Hello,
I'm using the comboBox component in a Flash form. I need to
set a "Var" so that it ports in my database correctly.
How can I do this?
Thanks!ok, I found some stuff (finally got this to work). This
worked for me--
submit_btn.onRelease = function(){
onSubmit();
function onSubmit() {
formData = new LoadVars();
formData.quanity = quanity.getValue();
if (mailList.getValue() == 1)
formData.mailList = 1;
} else {
formData.mailList = 0;
formData.sendAndLoad("email_request.php", formData, "Post");
where quanity is the instance name for the comboBox
and submit_btn is the instance name for the button.
I found this on another forum at---
http://actionscript.org/forums/showthread.php3?t=40434
so, I hope this helps you guy's, it deffinately helped me.
thanks again, and good luck,
hutch
Maybe you are looking for
-
Creation of replenishment orders in RR monitor
I am not being able to create a replenishment order on the basis of already created planned receipt by running the service (REPL_FRPROP_SERVICE) interactively. Following are the errors that I have been getting 1.Technical error in Firm Receipts gener
-
I want to upgrade my macbook pro with new mac pro (2011).any ideas?
i want to upgrade my mid 2010 mac pro with the latest one. what i need to do for this?
-
Exports From Audition CC Give "Header Error" in Premiere Pro CS6
Hello, I have finished the audio mixing on a 15 track project in Audition CC. It is very heavy so I had to export all the tracks separately to import them back into the Premiere Pro CS6 movie project. That way I could also do further adjustments in i
-
this has been steadily getting worse over the last few weeks is there a fix for this issue or is it poor quality component, I bought this monitor for doing graphic design on for good colour reproduction etc its certainly not the cheapest monitor out
-
Is there an MSI version of 11.0.10?
If not, is there a way to package and roll out this version of Reader? I noticed on the Adobe site that the MSI versions disappeared after v11.0.0 Thanks David