Actionscript for Dynamic Text
I am designing my first flash site, and created a Dynamic
text field called header_txt. I want the content inside this field
changed based on which page the user navigates to. I have used an
"IF" statement inside a Declared Function , but wonder if that is
the best option, also, my IF statement is no working. Here it is:
function headingChange() {
if (_root._currentframe == "contact") {
header_txt.text = "Contact Us";
} else if (_root._currentframe == "about") {
header_txt.text = "About Us";
headingChange();
var header_txt:String = "";
Why is this not working, and what would be a better way of
changing this field?
Thanks for the help!
Chuck
_currentframe only returns a number. You can't access the
frame's label with actionscript, except to specify it as a
parameter in the gotoAndPlay() method.
I would assume that you are calling the headingChange()
function at each labeled frame. If you are, then just change the
function call to this:
At frame labeled "contact": headingChange("contact");
At frame laveled "about": headingChange("about");
Change your function to read as follows:
function headingChange(s:String) {
if (s== "contact") {
header_txt.text = "Contact Us";
} else if (s== "about") {
header_txt.text = "About Us";
Or, you could just access your dynamic textfield directly
everytime you get to a new frame with a label by executing the
following code in a frame:
At the frame labeled "about": header_txt.text = "About Us";
Either way would work. Though I like keeping stuff like this
in a function. It makes it easier to update so that it does more in
the future.
Tim
Similar Messages
-
Language translations for dynamic texts
Hi
can somebody pls help me on doing the translations for dynamic texts, for eg, I am getting some values into a checkbox group and dropdowns at runtime , these values are not stored in any .xlf files,
pls let me the know the procedure of translating these dynamic values.
appreciate your help
Thanks
RADHi poojith,
thanks for your response,
how can I use this message pool in my code. I know the message pool has been used for warning messages and can be called in the application as wdcomponentAPI.getmessagemanager.reportWarning (.....)..
but in my case it is a checkbox group where fields will be fetched from a database dynamically when we run the application
for (int i = 0; i < abcprp.length; i++) {
ICheckboxGroupElement theElement = wdContext.nodeCheckboxGroup().createCheckboxGroupElement();
strName = abcprp<i>.getName().toString();
theElement.setFieldNames(strName);
wdContext.nodeCheckboxGroup().addElement(theElement);
I have got more than 50 fields which I will get from the above code..
can somebody pls explain me in the above scenario hw can we use the translation
Edited by: RAD on Sep 15, 2010 10:03 AM
Edited by: RAD on Sep 15, 2010 10:21 AM -
I am looking to create a good dynamic text scroller like the
one that
is a component. Any one have information on how to make one
it is
really appreciated.
Thanks
RandyIn your program and dynamic actions use structure RP50D for return dates (RP50D-DATE1 and RP50D-DATE2 to retrun values)
0000 06 75 I INS,0041,,,(RP50D-DATE1),(RP50D-DATE2)/D
0000 06 76 W P0041-DAR01='01'
0000 06 77 W P0041-DAT01=RP50D-DATE1
PROGRAM ZHPADYN.
TABLES : RP50D,
P0000,
P0041.
*& Form GET_DATE
* text
FORM GET_DATE .
DATA : I0041 LIKE P0041,
L_DAT LIKE P0041-DAT01,
L_DAR LIKE P0041-DAR01.
PERFORM READ_INFOTYPE(SAPFP50P) USING P0000-PERNR
'0041'
P0000-BEGDA
P0000-ENDDA
'1'
'NOP'
I0041.
DO 12 TIMES
VARYING L_DAR FROM I0041-DAR01 NEXT I0041-DAR02
VARYING L_DAT FROM I0041-DAT01 NEXT I0041-DAT02.
IF L_DAR = 'HR'.
RP50D-DATE1 = L_DAT.
ENDIF.
IF L_DAR = 'PE'.
RP50D-DATE2 = L_DAT.
ENDIF.
ENDDO.
ENDFORM. "GET_DATE
Hope this helps,
Puneet -
If else conditional statements for dynamic text fields (as 2.0)
This is about a self assesment quiz.There will be four options and each one has a scale from1-5 ie "option a" has 1mark, "option b" has 2marks,"option c" has 3 marks, "option d" has 4marks and "option e" has 5 marks and we count the answerd and we display the scor for example if there are 20 question in it if they answered "option e" 5 times the score will be
25 and option d 5 times the score will be 20,anf if "option c" for 5 times the score will be 15,and "option b" for 3 times the score will be 6 and "option a" two times the score will be 2, and we add up all the score and display in a dynamic text field called "scor" and the total score is 68.And i have another dynamic text field called "tsc" where i have to display the tags like excellent , good, better ......ect.
Till now every thing is fine but i am unable to compare them it is displaying excellent even if i get 10 marks, i am unable to configure where i am going wrong.
If the score is greater than 55 "tsc" should display Excellent, if the score is greater than 41 or less than 55 "tsc" should display Best, if the score is greater than 26 or less than 40 "tsc" should display Better,if the score is none of the above "tsc" should display Poor.
This is my code on the submit button:
on (release) {
gotoAndStop("sQ");
if (scor>=55) {
tsc = "Excellent";
} else if (scor == 41 && scor<=55) {
tsc = "Best";
} else if (scor == 26 && scor<=40) {
tsc = "Better";
} else if (scor == 10 && scor<=25) {
tsc = "Good";
} else {
tsc = "Poor";
where:
"sQ" is the frame name where i am displaying the score details
"scor" is the var name for the dynamic text field for displaying total score
"tsc" is the var name for the dynamic text field for displaying the tags llike good, Excellent, better, poor.....etc
Plese help.......Use trace commands to make sure that what you think you are processing is what is actually hapenning.
Your middle conditionals are not written as you described them... any "==" should be ">="
It is recommended you get away from using the textfield var option... it can be troublesome to work with. Just assign an instance name to the textfield and assign the values to its text property... for instance, say you name it tscField, then you would use tscField.text = "Excellent";
Also, realize that the gotoAndStop command will not happen until after all the code executes in case that matters
on (release) {
gotoAndStop("sQ");
trace(scor);
if (scor>=55) {
tsc = "Excellent";
} else if (scor >= 41 && scor<=55) {
tsc = "Best";
} else if (scor >= 26 && scor<=40) {
tsc = "Better";
} else if (scor >= 10 && scor<=25) {
tsc = "Good";
} else {
tsc = "Poor"; -
Limit total value for dynamic text
Hi,
I've got two buttons: one which increases the value of a
dynamic text box by 1, and one which decreases the same text by 1.
I need to set a limit on the value of the dynamic text box, to -35
to +35.
The code I've got so far:
//set inital value of text box
trial1_txt.text = 0;
//control the increase button
this.Increase_btn.onPress = function(){
trial1_txt.text++;
//control the decrease button
this.Decrease_btn.onPress = function(){
trial1_txt,text--;
Any help would be greatly appreciated! I'm SOOOOO stuck on
this one!
Thanks!Thank you! That works perfectly:-)
-
Dynamic text not displaying when publishing for flash 8
This dynamic text works fine when the movie is published for
flash 7, but when i export for the flash 8 player it seems to be
invisible. Is there any obvious reason for this happenning?
thanks
jonOk, thanks, looks like you've pointed me in the right
direction. I havent fixed it yet though. Heres where i am at:
eval(theTarget+".buttonPrime").tex.embedFonts = false;
now i can see my text. of course its using a default font.
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "arial14b";
eval(theTarget+".buttonPrime").tex.embedFonts = true;
eval(theTarget+".buttonPrime").tex.text = "wasssup?";
eval(theTarget+".buttonPrime").tex.setTextFormat = my_fmt;
this isnt working. I have added a font object to the library
and linked it for actionscript using the monkier "arial14b".
however my text is quite invisible. i have checcked, 'export in
first frame' for the font object i even tried it with this
deselected. i have deselected the embed font option on the text
feild itself. that doesnt work either (unless i dont try to set the
text format, so long as i accept a default font, its fine).
so err, help?
confused
jon
ps further to this is have discovered more about this strange
behaviour. i can set the text to a different string, provided i do
not try to embed the font in any way. if i set the font to embed, i
can have the text display with the correct font, until i change the
text. then it dissappears. also i cannot seem to affect properties
like font size by means of my TextFormat object. the textFormat
object also does not seem to affect the font of the text.
in short, when exporting for flash 8, i cannot seem to
successfully embed fonts for dynamic text. the only thigs i have
gotten to work are: static text (or a dynamic text feild with
unchanged text) with an embedded font, or dynamic text with a
default font. -
CS5 - Text format for classic text error
will now have to re-edit every part.
Clearly you can get around this by other formats but fact is if you have a document that has negative spacing dont open it in CS5 cause you
This may have been in recent update.
Flash now resets them when you open the file to 0, if you notice or not.
when you have negative (-20) set in spacing, usually used when you have margins.
Classic Text Error
Flash CS5Here's a workaround.
FixTextIndent is a class with static methods that
provides a workaround for the Flash CS5 text formatting
bug. The Flash CS5 IDE will not remember the text
indent setting for either static or dynamic text fields.
We can set the indent in Actionscript for dynamic fields,
so to use this class, convert your fields to dynamic,
then set the left margin.
When you call FixTextIndent methods, they will set
the indent to the negative of the left margin.
Gary Weinfurther, 12/17/2010
package com.keysoft.util
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flash.text.TextField;
import flash.text.TextFormat;
public class FixTextIndent
Fixes the line indent of all dynamic text fields
in a given display object container so that
the indent is the negative of their left margin.
public static function FixContainer(container:DisplayObjectContainer):void
for(var i:int = container.numChildren - 1; i >= 0; --i)
var obj:DisplayObject = container.getChildAt(i);
if (obj is TextField)
FixTextField(obj as TextField);
Fixes the line indent of a dynamic text field
to the negative of its left margin
public static function FixTextField(tf:TextField):void
var format:TextFormat = tf.getTextFormat();
if (format.leftMargin != null && format.leftMargin > 0)
format.indent = -(format.leftMargin as Number);
tf.setTextFormat(format); -
I know that it's possible to create Placeholder Text. However I'm looking for dynamic text. I frequently deal with documents where I need to update 30 fields with the same information. Rather than going 30 times and replacing the Placeholder Texts with the correct info, I'd love to be able to just fill out a couple fields and the remaining ones to populate dynamically. Kind of how you can create cell references in Apple Numbers and Excel, I'd love to create references for text.
Any ideas on how to achieve this?Pages does not have Dynamic Text.
Use a marker placeholder eg «example1»
Then use Find and Replace to substitute what you want.
Peter -
Help with code for score-keeping with dynamic text box
Hi All,
I'm having an actionscript 2.0 problem with keeping score.
I have a dynamic text box with a variable called score.
I have the following action code for that variable:
_root.score = 0;
For the correct answer button I have this action:
_root.score = Number (score) +10;
This works fine to increase the score by 10 for each correct answer.
The problem is that I can't get an if statement to work for when the score reaches 150 to gotoAndPlay a certain frame. I've tried various syntax, I've tried it on the action for a button and an action for the timeline with:
onRelease = function () {
(My learning game is set up to allow for users to answer up to four extra questions to reach the score of 150).
Nothing works. Any suggestions please?
PamBelow is a link to a small sample file. See if you can find anything different between your file and the one linked that might cause yours to not work as desired.
http://www.nedwebs.com/Flash/AS2_score_sample.fla -
Dynamic action for a text fiel in a tabular form
for a text field of a, wizzard generated, tabular form i created a dynamic action when lost focus. using a jquery selector to bind the da to the item in every row
when the event fires some jscript and pl/sql code is executed. this all works like charm for existing rows.
but how can i bind the da to the field for newly added rows?
a sc of the definition of the da can be found here https://dl.dropbox.com/u/25663382/SNAG-0043.jpg
APEX 4.1.1.00.23
any idea?
thanks in advance
peterJust change the bind to live
That will do the trick
http://stackoverflow.com/questions/937039/what-is-the-difference-between-the-bind-and-live-methods-in-jquery -
Dynamic Text for data series ?
Hi, is posible setting dynamic text in data series when use dynamic value ?
We need show Actual Year value and Last Year value in Label for Series.
Thank you.This is not possible unless you have enhancement pack 1 for visual composer which I think is still in rampup...
Here is the enhancement noted in the article below.
Taken from blog:
Option to dynamically define element titles
For chart views, form views, table views, HTML views, nested iViews and popup iViews (popup signal), you can now define dynamic titles using the Expression Editor. A new (ellipsis) button to the right of the field in the Configure Element task panel displays the Title Editor dialog box, in which you enter either or define a custom expression.
/people/judy.kestecher/blog/2008/08/26/whats-new-in-visual-composer--enhancement-package-1-for-sap-netweaver-70 -
Dynamic Text preparation for Command button in ADF (Tr component)
We have one command link and our requirement is to preapre the command button text dynamicaly .?
Details are givin below :
I need to get the button text value form the UCMS file based on the dynamic preparation .
The key value of UCMS is "setupfamily_group_1-8FAM4".
In the above mentioned key value the part 1 is "*setupfamily_group*_" is static text and part 2 "*1-8FAM4*" is dynamic which i will get throuth the List of Objects.
i.e managedServices.product.productId. here managedSercies is varible contains the Objects from the list.
please let me know how to append the part1 and part 2 as mentioned above in Command button text field ?
<tr:forEach items="#{pageFlowScope.myExtrasBean.managedServicesExtras}"
var="managedServices">
<tr:commandButton text="#{myExtrasBundle.setupfamily_group_+#managedServices.product.productId}" id="setup_service"
actionListener="#{pageFlowScope.myExtrasBean.manageMyFamilyProducts}"
action="vfFamilyFlow">
<f:attribute name="productId" value="#{managedServices.product.productId}"/>
</tr:commandButton>
</forEach>
We not getting how to append the Static and dynamic text for command button text filed ? pleas let me know the syntax .
ThanksHI
We have tried with above both options .its issues not resolved .
for the first one we are getting the compile time error
and for the second option ,when we run the dynamic value its self printing in the JSF .
We are trying to prepare the command button text as some part dynamically and some part static and its will act as key in the XML and get the corresponding value from the UCMS .
Thanks -
Dynamic Texts from Bex ( for Key Figures ) not coming to WEBI Query
Hi Gurus,
We have a Query in BEx : Each Key figure column text changes dynamically - Like based on Present month
it will Display Month +1 Month +2 up to Month +12. Used dynamic Text variables .
But when i created the universe and Webi report , i am missing the text in the column for Key figures .
How should i get the column text in Webi which is same as in Bex : Points will be awarded for helpful
answers.
Thanks
MaggeHi,
text variables with replacement path are supported in BO4.0, see following document: SAP BusinessObjects BI4 - Supported BEx Query Elements
As an example after entering 2012 in the prompts window, the name of the corresponding key figure will dynamically change:
After refreshing and selecting 2013, the column name will update:
Im not sure though if this is the case with unv universe access to BEx queries.
Best regards,
Victor -
Creating Dynamic Text Field for Flash CS3 in Illustrator CS3
I've created a series of buttons in an illustration and made
them into movie clip symbols in Illustrator. I then created some
text fields for the button labels and assigned them as dynamic text
in the Flash Text panel in Illustrator.
When I import the illustration into Flash and test the movie,
I get this error message:
TypeError: Error #1034: Type Coercion failed: cannot convert
flash.text::TextField@d18cef9 to flash.display.MovieClip.
at
flash.display::Sprite/flash.display:Sprite::constructChildren()
at flash.display::Sprite$iinit()
at flash.display::MovieClip$iinit()
at menu2_fla::MainTimeline$iinit()
It seems like Flash is misinterpreting the text fields
brought in from Illustrator as Movie Clips?Download the TinkSpark source from http://code.google.com/p/tink/source/checkout and add the package to your project:
Then write the following code:
import ws.tink.core.Library;
import ws.tink.events.LibraryEvent;
import ws.tink.managers.LibraryManager;
private function loadLibrary():void
var library:Library = LibraryManager.libraryManager.createLibrary( "assetsLibrary" );
library.addEventListener( LibraryEvent.LOAD_COMPLETE, onAssetsLibraryLoadCompleteHandler, false, 0, true );
library.loadSWF("board.swf" ); //provide the path of board.swf, pls note board.swf is alos exported as AS3.0
private function onAssetsLibraryLoadCompleteHandler( event:LibraryEvent ):void
EventDispatcher( event.currentTarget ).removeEventListener( event.type, arguments.callee );
var library:Library = LibraryManager.libraryManager.getLibrary( "assetsLibrary" );
var AssetScore:Class = library.getDefinition( "Score" );
var score:* = new AssetScore() as Sprite;
score.scoreDisplay.text = "100";
addChild( score );
Warm Regards
Deepanjan Das
http://deepanjandas.wordpress.com/ -
Agentry - Dynamic text for Platform wizard button?
Hi,
I want to reuse the same screen set navigating from 2 different places.
The text for the "Move to the Next Screen (cannot back up) platform wizard button should be different in each case to make it easier to understand for the end user. Apparently the only option is to hardcode a text, but I would like to know if it could be possible to use a rule or something to display a dynamic text for the wizard button.
Thank you,
MarçalHi Marcal,
Unfortunately that idea was shot down a while ago, though it would be nice. The general dividing rule I use is if the question is appropriate for Agentry regardless of whether it is installed standalone (like Work Manager 5.3) or on any version of SMP, then it should be in SAP for Mobile. These are usually application development or customization types of questions. The Agentry landing page is in SAP for Mobile for that reason. Though the line is definitely getting blurry now that Agentry apps are moved or moving to the SMP.
If the question relates to Agentry issues which directly involve SMP (usually installation, implementation, or configuration), then it should be in SAP Mobile Platform Developer Center.
I am planning to put together a blog or several to help go through where and why different posts should be placed. Also one about tagging!
Thanks, Mike
SAP Customer Experience Group - CEG
Maybe you are looking for
-
Photoshop CS2 Activation Problem
Hello I'm trying to install Photoshop CS2 for a client, but when I launch the application I get the error: "An error has been detected and activation cannot continue. Please restart your computer and reinstall the application" I've already done the o
-
Photos received in Facebook are too dark
Photos posted in albums on Facebook by friends are often too dark to identify the people. However, other people can go on Facebook and view the same album on their computers and they are fine. I use Firefox on a Mac OS X, version 10.4.11. It happens
-
Strange message on ipod - Wont reset????????
I got an message on the ipod with video. It says "accesorize test plug FW" and a bunch of letters. Anyone know what this is? My ipod wont reset either??? cheers
-
How does it work...LOOP,..ENDLOOP logic
I just tried the script below to understand the loop logic. FIX ("Person","Jan") var c=0; LOOP(2) "wage" c=c+1; c; ENDLOOP ENDFIX I expected that the result of the calculation would be wage = 2 but instead I found wage = 10. I tried this with LOOP(2)
-
adobe photoshop