Adding a math amount to dynamic text
Hi all,
I am working on a key pad that has a clock, allows you to
enter a time amount and then count down that amount or add seconds
to it.
Here is the file:
Flash
movie
As you can see there are a few things that I have been unable
to do due to my beginning skill level:
1a) 2 :34 PM isnt really a functioning clock, its just text.
While it doesn't need to actually work like a real clock, it should
have the colin blinking, and when you press any of the 1 - 9
numbers, it should clear away and present : 00, or : 0(number of
pressed button).
1b) How do I constrain the dynamic text box to only four
numbers in the format of "xx : xx", where x is any number from 0 to
9, then a space on either side of the colin. Numbers get added from
the right x first and get pumped to the next placeholder. (dc : ba)
2) Again, pressing OK doesnt really countdown anything, it
just says "cooking'. Upon pressing OK, how to I tell the button to
count down to zero whatever the number is in the dynamic text box?
3) The add button is supposed to add 2 seconds to whatever
number (except the clock) is displayed in the dynamic text box, but
it simply places a 2 next to the numbers. If 1:04 is displayed,
then pressed Add should equate 1:06, not 1:042
Here is the code:
btn1.theNumber.text = "1";
btn2.theNumber.text = "2";
btn3.theNumber.text = "3";
btn4.theNumber.text = "4";
btn5.theNumber.text = "5";
btn6.theNumber.text = "6";
btn7.theNumber.text = "7";
btn8.theNumber.text = "8";
btn9.theNumber.text = "9";
btn0.theNumber.text = "0";
okButton.theNumber.text = "OK";
cancel.theNumber.text = "CANCEL";
addmore.theNumber.text = "Add";
theCode.text = "2 : 34";
btn1.onPress = function () {
theCode.text += "1";
btn2.onPress = function () {
theCode.text += "2";
btn3.onPress = function () {
theCode.text += "3";
btn4.onPress = function () {
theCode.text += "4";
btn5.onPress = function () {
theCode.text += "5";
btn6.onPress = function () {
theCode.text += "6";
btn7.onPress = function () {
theCode.text += "7";
btn8.onPress = function () {
theCode.text += "8";
btn9.onPress = function () {
theCode.text += "9";
btn0.onPress = function () {
theCode.text += "0";
okButton.onPress = function () {
theCode.text = "Cooking";
cancel.onPress = function () {
theCode.text = "2 : 34";
addmore.onPress = function() {
theCode.text = theCode.text + 2;
Ok,
Here is what I have been trying, seen below, following what
Don mentioned. However, I get an error if I keep the " " around the
0 in the last bit of code. And in reference to my first post, how
do I expand the code to satisfy those questions. I'll keep trying!
btn0.theNumber.text = "0";
btn1.theNumber.text = "1";
var numZero:Number = 0;
var numOne:Number = 1;
var numTwo:Number = 2;
var numThree:Number = 3;
var numFour:Number = 4;
var numFive:Number = 5;
var numSix:Number = 6;
var numSeven:Number = 7;
var numEight:Number = 8;
var numNine:Number = 9;
btn0.onPress = function () {
theTime.text = numZero
btn1.onPress = function () {
theTime.text = numOne
if(numZero <10){
numZero = "0" + numZero
**Error** Scene=Scene 1, layer=actions, frame=1:Line 27: Type
mismatch in assignment statement: found String where Number is
required.
numZero = "0" + numZero
Total ActionScript Errors: 1 Reported Errors: 1
Similar Messages
-
Adding Scrollbar and buttons to Dynamic Text
Hello,
I am trying to connect dynamic text to scrollbar and buttons. I did tutorial and Lynda.com and practically pasted the code in with my file names and for some reason it does not work. It says I have a "Access of Undefined Property mask_mc" Did I need to create a variable for this? I didn't in the tutorial.
Right now I have the dynamic text loading successfuly in 2 different places and I wantd to add the scrollbar. I put the variables on frame 1 code and then I put the actually load code on the frame where it is needed.
Any suggestions?
Thanks! Sandra
HERE IS CODE FOR FRAME 1:
var textLoader:URLLoader = new URLLoader();
var textReq:URLRequest;
var scrollPercent:Number = 0;
var minScroll:Number;
var maxScroll:Number;
var targetScroll:Number = philText_mc.y;
var easing:Number = 5;
var scrollAmt:Number = 15;
var scrollDirection:Number = 0;
HERE IS CODE FOR FRAME WHERE TEXT LOADS:
textReq = new URLRequest("text_philosophy.txt");
function philosophyTextLoaded(event:Event):void {
philText_mc.philosophy_txt.text = textLoader.data;
minScroll = philText_mc.y;
maxScroll = minScroll - philText_mc.height + mask_mc.height;
function dragScroller(event:MouseEvent):void
var dragX:Number = line_mc.x - scroller_mc.width/2 + 1;
var dragY:Number = line_mc.y;
var dragW:Number = 0;
var dragH:Number = line_mc.height - scroller_mc.height;
scroller_mc.startDrag(false, new Rectangle(dragX,dragY,dragW,dragH));
stage.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
stage.addEventListener(Event.ENTER_FRAME, setScrollPercent);
stage.removeEventListener(Event.ENTER_FRAME, scrollText);
function stopDragging(event:MouseEvent):void
scroller_mc.stopDrag();
function setScrollPercent(event:Event):void
scrollPercent = (scroller_mc.y - line_mc.y) / (line_mc.height - scroller_mc.height);
if(scrollPercent < 0)
scrollPercent = 0;
else if(scrollPercent > 1)
scrollPercent = 1;
targetScroll = (scrollPercent * (maxScroll - minScroll)) + minScroll;
philText_mc.y -= (philText_mc.y - targetScroll) / easing;
function scrollUp(event:MouseEvent):void
setDirection(scrollAmt);
function scrollDown(event:MouseEvent):void
setDirection(-scrollAmt);
function setDirection(dir:Number):void
scrollDirection = dir;
stage.addEventListener(Event.ENTER_FRAME, scrollText);
stage.addEventListener(MouseEvent.MOUSE_UP, stopScrolling);
stage.removeEventListener(Event.ENTER_FRAME, setScrollPercent);
function scrollText(event:Event):void
targetScroll += scrollDirection;
philText_mc.y -= (philText_mc.y - targetScroll) / easing;
if(philText_mc.y > minScroll)
philText_mc.y = minScroll;
targetScroll = minScroll;
else if(philText_mc.y < maxScroll)
philText_mc.y = maxScroll;
targetScroll = maxScroll;
scrollPercent = (philText_mc.y - minScroll) / (maxScroll - minScroll);
scroller_mc.y = (scrollPercent * (line_mc.height - scroller_mc.height)) + line_mc.y;
function stopScrolling(event:MouseEvent):void
scrollDirection = 0;
textLoader.load(textReq);
scroller_mc.buttonMode = true;
philText_mc.external_txt.autoSize = TextFieldAutoSize.LEFT;
scroller_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragScroller);
textLoader.addEventListener(Event.COMPLETE, philosophyTextLoaded);
up_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollUp);
down_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollDown);Hello again,
Maybe I am asking this question wrong. Instead of making you try and figure out what's going on in my file what I really need to know is how you would take this code I am attaching and make it happen on another frame besides frame 1 and it doesn't appear on frame 1. I think this may help me understand a little better.
Also another way I was thinking to get around this would be to pull in an external swf into the spot where I want this text to go because I can make the scrollbars and external text work when it is the only thing going on in the movie. Would this be a bad way to set this up? and also SInce it is an external movie would I have maintimeline issues with mouse/scroller control?
thanks! sandra
Here is working code:
var textLoader:URLLoader = new URLLoader();
var textFile:URLRequest = new URLRequest("text/external.txt");
var scrollPercent:Number = 0;
var minScroll:Number;
var maxScroll:Number;
var targetScroll:Number = text_mc.y;
var easing:Number = 5;
var scrollAmt:Number = 15;
var scrollDirection:Number = 0;
function textLoaded(event:Event):void
text_mc.external_txt.text = textLoader.data;
minScroll = text_mc.y;
maxScroll = minScroll - text_mc.height + mask_mc.height;
function dragScroller(event:MouseEvent):void
var dragX:Number = line_mc.x - scroller_mc.width/2 + 1;
var dragY:Number = line_mc.y;
var dragW:Number = 0;
var dragH:Number = line_mc.height - scroller_mc.height;
scroller_mc.startDrag(false, new Rectangle(dragX,dragY,dragW,dragH));
stage.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
stage.addEventListener(Event.ENTER_FRAME, setScrollPercent);
stage.removeEventListener(Event.ENTER_FRAME, scrollText);
function stopDragging(event:MouseEvent):void
scroller_mc.stopDrag();
function setScrollPercent(event:Event):void
scrollPercent = (scroller_mc.y - line_mc.y) / (line_mc.height - scroller_mc.height);
if(scrollPercent < 0)
scrollPercent = 0;
else if(scrollPercent > 1)
scrollPercent = 1;
targetScroll = (scrollPercent * (maxScroll - minScroll)) + minScroll;
text_mc.y -= (text_mc.y - targetScroll) / easing;
function scrollUp(event:MouseEvent):void
setDirection(scrollAmt);
function scrollDown(event:MouseEvent):void
setDirection(-scrollAmt);
function setDirection(dir:Number):void
scrollDirection = dir;
stage.addEventListener(Event.ENTER_FRAME, scrollText);
stage.addEventListener(MouseEvent.MOUSE_UP, stopScrolling);
stage.removeEventListener(Event.ENTER_FRAME, setScrollPercent);
function scrollText(event:Event):void
targetScroll += scrollDirection;
text_mc.y -= (text_mc.y - targetScroll) / easing;
if(text_mc.y > minScroll)
text_mc.y = minScroll;
targetScroll = minScroll;
else if(text_mc.y < maxScroll)
text_mc.y = maxScroll;
targetScroll = maxScroll;
scrollPercent = (text_mc.y - minScroll) / (maxScroll - minScroll);
scroller_mc.y = (scrollPercent * (line_mc.height - scroller_mc.height)) + line_mc.y;
function stopScrolling(event:MouseEvent):void
scrollDirection = 0;
textLoader.load(textFile);
scroller_mc.buttonMode = true;
text_mc.external_txt.autoSize = TextFieldAutoSize.LEFT;
scroller_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragScroller);
textLoader.addEventListener(Event.COMPLETE, textLoaded);
up_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollUp);
down_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollDown); -
Adding page break while printing dynamic text matter
Hi!
This is a bit of a tough one ...
Im trying to print the content of a large scroll pane that
spans multiple pages. So far i have managed to get the contents
printing out, dividing the content between the pages using the
PrintJob class.
My problem now is that i want to add a header and footer
(both movie clips) on each page and want to add page break like
ms-word.Still playing around with this, but I still can't get it to work correctly. I've selected Page 1 and tried to change the Content from Positioned to Flowed, but when I do, all my boxes are moved to the 2nd page, and the items on the 2nd page are now on the 3rd page. Can't for the life of me figure this out.
I just want my boxes to grow as you type in them, allowing them to expand to additional pages by moving existing test boxes down the page. -
Added dynamic text; How do I stop variable name from showing?
I am creating a simple game for kids. On the first page, I added an "input text" field for their first name. I called the variable firstname.
When they move to the next page, I used a "dyanamic text" field so I can call them by name on this page. It works. However, When I test the game, on the first page, where the firstname is input, it shows _level0.firstname instead of just a blank space for them to input their name.
I know I fixed this in the past and it was something simple, but I can't remember how to do it. I'd appreciate anyone's help!
Thanks.Beginning with Flash MX (version 6), you assign the text field an instance name using the Property inspector. Although you can use the variable name method with dynamic text fields for backwards compatibility to Flash 5 and earlier versions, Macromedia doesn't recommend this, because you can't control other text field properties, or apply style sheet settings
-
Adding a progress loader to a dynamic text field / scrollPane
I have a dynamic text field which is loading images from an external html. This text is named scrollPaneImage and is a child of a movieClip called scrollPaneContent. I then load scrollPaneContent into a scroll pane named scrollPane
When the user interacts with my swf different images are loaded into scrollPaneImage. Since some of the images take a few seconds to load, I'd like there to be a progress loader displayed in the scrollpane.
I have tried adding the progress event listner to the dynamic text, the movie clip and the scrollpane and cannot get it to respond or track the loading.
scrollPaneContent.addEventListener(ProgressEvent.PROGRESS,reportProgress);
function reportProgress(e:ProgressEvent):void {
trace(e.bytesLoaded + " loaded out of " + e.bytesTotal);
trace("LOADED");
Can anyone suggest what I might be doing wrong or of another approach?
thanks in advance,
JoshHi KGLAD. Thanks for the response. Yes my code is a little messy. Here I have included everything and tried to do a little cleaning. Is there enough code here for you to get an idea of how/when things are firing?
import com.google.maps.LatLng;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapType;
import com.distriqt.gmaps.kml.utils.*;
import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.TweenLite;
import flash.geom.Point;
import com.greensock.plugins.*;
TweenPlugin.activate([AutoAlphaPlugin]);
import com.google.maps.controls.NavigationControl;
import com.google.maps.controls.MapTypeControl;
import com.google.maps.controls.OverviewMapControl;
import com.google.maps.overlays.GroundOverlay;
import com.google.maps.overlays.GroundOverlayOptions;
import com.google.maps.LatLng;
import com.google.maps.LatLngBounds;
import com.google.maps.MapMouseEvent;
import com.google.maps.controls.*;
import com.google.maps.overlays.Marker;
import com.google.maps.InfoWindowOptions;
import com.google.maps.overlays.MarkerOptions;
import com.anttikupila.utils.JPGSizeExtractor;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.net.URLLoader;
import fl.controls.UIScrollBar;
import flash.events.Event;
import fl.events.ScrollEvent;
import flash.sampler.NewObjectSample;
[Embed(source="ICONS/PHOTO_BLACK.png")]var photoIcon:Class;
[Embed(source="ICONS/BLOG_BLACK.png")]var blogIcon:Class;
scrollPane
// GMAP PARAMETERS
var map:Map = new Map();
map.key = "map key";
//map.key = "api key";
//define the size of the map extent....
map.sensor = "false";
map.setSize(new Point(stage.stageWidth, stage.stageHeight));
map.addEventListener(MapEvent.MAP_READY, onMapReady);
map.addEventListener(MapEvent.MAP_READY, createmarkers);
map.addEventListener(MapEvent.MAP_READY, createMarkerArrays);
map.addEventListener(MapEvent.MAP_READY, createPhotoPingers);
this.addChild(map);
map.setSize(new Point(stage.stageWidth, stage.stageHeight));
//on map ready params
function onMapReady(event:Event):void
map.setCenter(new LatLng(48,-113.5), 8, MapType.PHYSICAL_MAP_TYPE);
map.enableScrollWheelZoom();
map.disableContinuousZoom();
//Marker options for a photo piece
var photoMarkerOptions:MarkerOptions = new MarkerOptions();
photoMarkerOptions.icon = new photoIcon();
photoMarkerOptions.hasShadow=false;
//Marker options for a blog piece
var blogMarkerOptions:MarkerOptions = new MarkerOptions();
blogMarkerOptions.icon = new photoIcon();
blogMarkerOptions.hasShadow=false;
//load xml tester
var pntloader:URLLoader = new URLLoader();
var pntxml:XML = new XML();
pntloader.addEventListener(Event.COMPLETE, loadpntXML);
pntloader.load(new URLRequest("map_feed.xml"));
// create an array of jpgs to index
var JPGIndexArray:Array = new Array();
//Create array that will be populated with points
var pointsArray:Array = new Array();
//Load the XML
function loadpntXML(e:Event):void {
pntxml=new XML(e.target.data);
pntxml.ignoreWhite = true;
for (var i:int = 0; i< pntxml.row.length(); i++){
pointsArray[i]="mrk"+i;
JPGIndexArray[i]="JPG"+i;
//trace(pntxml);
//Create the markers and add them to the map
function createmarkers(event:Event):void
for (var i:Number = 0; i < pntxml.row.length(); i++) {
var markerOptions:MarkerOptions = new MarkerOptions();
if (pntxml.row[i].TYPE=="PHOTO")
markerOptions.icon = new photoIcon();
markerOptions.tooltip = "Photo";
markerOptions.hasShadow=false;
else if(pntxml.row[i].TYPE=="BLOG")
markerOptions.icon = new blogIcon();
markerOptions.tooltip = "Blog Entry";
markerOptions.hasShadow=false;
else
null
pointsArray[i] = new Marker(new LatLng(pntxml.row[i].LAT,pntxml.row[i].LONG),markerOptions);
markerA.push(pointsArray[i]);
map.addOverlay(pointsArray[i]);
pointsArray[i].addEventListener(MapMouseEvent.CLICK,indexCalledMarkerRecord);
pointsArray[i].addEventListener(MapMouseEvent.CLICK,scrollPanePopulate);
// PING PHOTO DIMENSIONS BEFORE LOADING //
var je : JPGSizeExtractor = new JPGSizeExtractor( );
je.addEventListener( JPGSizeExtractor.PARSE_COMPLETE, jeLoadHandler );
je.addEventListener( JPGSizeExtractor.PARSE_FAILED, jeParseFailed );
function createPhotoPingers(event:Event):void{
for (var k:Number=0; k <pntxml.row.length(); k++){
JPGIndexArray[k]=new JPGSizeExtractor();
JPGIndexArray[k].debug = false;
JPGIndexArray[k].addEventListener(JPGSizeExtractor.PARSE_COMPLETE, jeLoadHandler );
trace("madeit");
pingPhotoUrls();
function pingPhotoUrls():void
for (var i:Number = 0; i < pntxml.row.length(); i++) {
var calledMarkerUrl=pntxml.row[i].URL_OF_CONTENT;
JPGIndexArray[i].extractSize(calledMarkerUrl);
var JPG1=null;
function jeLoadHandler(e:Event) : void {
trace(e.currentTarget.width + "x" + e.currentTarget.height );
imageWidths.push(e.currentTarget.width);
function jeParseFailed( event : Event ) : void {
trace( "Parse failed" );
var imageWidths = new Array;
// FUNCTIONS FOR INDEXING CALLED MARKERS//
//Create blank array for use in indexing
var markerA:Array=[];
//VAR FOR USE IN INDEXING CALLED MARKER
var pointindex=null;
//INDEX CALLED MARKER POINT XML RECORD
function indexCalledMarkerRecord(e:MapMouseEvent):void{
pointindex=genIndexPos(markerA,Marker(e.currentTarget));
//trace(pntxml.row[pointindex].DESC);
//FUNCTION FOR INDEXING CALLED MARKER
function genIndexPos(a:Array,e:Marker):uint{
for(var i:uint=0;i<a.length;i++){
if(a[i]==e){
return i;
return null;
// SCROLLPANE FUNCTIONS //
this.addChild(scrollPane);
scrollPane.setSize(255,300);
scrollPane.x=-200;
scrollPane.y=-200;
scrollPane.alpha=0;
scrollPaneContent.mouseEnabled=false;
spHeader.closeBox.addEventListener(MouseEvent.CLICK, function(eMouseEvent):void
TweenLite.to(scrollPane, .5,{autoAlpha:0,overwrite:true});
spHeader.forDrag.addEventListener(MouseEvent.MOUSE_DOWN, function (e:MouseEvent):void
scrollPane.startDrag();
spHeader.forDrag.addEventListener(MouseEvent.MOUSE_UP, function (e:MouseEvent):void
scrollPane.stopDrag();
spHeader.forDrag.buttonMode=true;
spHeader.forDrag.useHandCursor=true;
spHeader.width=300;
scrollPane.source = scrollPaneContent;
scrollPaneContent.scrollPaneText.autoSize='left';
scrollPaneContent.scrollPaneImage.autoSize='center';
scrollPaneContent.scrollPaneImage.autoSize=TextFieldAutoSize.CENTER;
scrollPaneContent.mouseEnabled=false;
scrollPaneContent.scrollPaneText.condenseWhite = true;
// Add listener.
scrollPane.addEventListener(Event.COMPLETE, completeListener);
scrollPaneContent.addEventListener(ProgressEvent.PROGRESS,reportProgress);
function completeListener(event:Event):void {
trace('Scrollpane content loaded');
function reportProgress(e:ProgressEvent):void {
trace(e.bytesLoaded + " loaded out of " + e.bytesTotal);
trace("LOADED");
function scrollPanePopulate(event:Event){
//show scroll pane
scrollPane.x=33;
scrollPane.y=33;
TweenLite.to(scrollPane, .5,{autoAlpha:1,overwrite:true});
TweenLite.to(spHeader, .5,{autoAlpha:1,overwrite:true});
//create the temp variables
var calledMarkerIndex=pntxml.row[pointindex].ID;
var calledMarkerDate=pntxml.row[pointindex].DATE;
var calledMarkerDescription=pntxml.row[pointindex].DESC;
var calledMarkerContent=pntxml.row[pointindex].URL_OF_CONTENT;
var imgWidth=JPGIndexArray[pointindex].width;
var imgHeight=JPGIndexArray[pointindex].height;
scrollPaneContent.scrollPaneText.htmlText="<font size='12' color='#000000'>"+calledMarkerDescription;
var imgBoxHeight=scrollPaneContent.scrollPaneImage.height;
var txtHeight=scrollPaneContent.scrollPaneText.height;
var contentHeight=(imgBoxHeight+txtHeight);
scrollPane.setSize(300,(contentHeight+15));
//size the text box
scrollPaneContent.scrollPaneText.width=270;
//if image is wide or tall, scale accordingly and create a string that will be used
if(imgWidth>=imgHeight){
var imgSource:String = "<img src="+"'"+calledMarkerContent+"'"+"width='"+250+"'"+"height='"+150+"'"+"/>";
var calledImgHgh=160;
else
var imgSource:String = "<img src="+"'"+calledMarkerContent+"'"+"width='"+110+"'"+"height='"+167+"'"+"/>";
var calledImgHgh=177;
//fill in the text
scrollPaneContent.scrollPaneImage.htmlText=imgSource;
//scrollPaneContent.scrollPaneText.htmlText="<font size='12' color='#000000'>"+calledMarkerDescription;
//pan the map to the called position
map.panTo(pointsArray[calledMarkerIndex-1].getLatLng())
//add the header to the SP and scale accordingly
scrollPane.addChild(spHeader);
spHeader.x=-1;
spHeader.y=1;
spHeader.width=299;
if (txtHeight>=250){
scrollPane.setSize(300,275);
scrollPaneContent.scrollPaneText.htmlText="<font size='12' color='#000000'>"+calledMarkerDescription+"<br><br>";
if (txtHeight<=5){
scrollPane.setSize(300,200);
scrollPaneContent.scrollPaneText.htmlText="<font size='12' color='#000000'>"+calledMarkerDescription;
if (txtHeight>=5){
scrollPane.setSize(300,275);
scrollPaneContent.scrollPaneText.htmlText="<font size='12' color='#000000'>"+calledMarkerDescription+"<br><br>";
// CREATE TEMP VARIABLES FOR POSITIONING AND PLACE DYNAMIC TEXT
var scTextY=scrollPaneContent.scrollPaneText.y;
var scImageY=scrollPaneContent.scrollPaneImage.y;
var scTextHeight=scrollPaneContent.scrollPaneText.height;
scrollPaneContent.scrollPaneText.y=scImageY+calledImgHgh;
//update the scrollpane and reset the scrollbar
scrollPane.update();
scrollPane.verticalScrollPosition=(0);
scrollPane.verticalScrollBar.height=270;
scrollPane.verticalScrollBar.x=281;
scrollPane.verticalScrollBar.y=3;
spHeader.alpha=0;
this.addChild(spHeader);
var photoMarkersArray=new Array();
var photoMarkersIndexArray=new Array();
//CREATE ARRAY OF PHOTO MARKERS
function createMarkerArrays(e:Event):void{
for (var j:int=0; j<pntxml.row.(TYPE=="PHOTO").ID.length(); j++){
var tempMarkerIndex=pntxml.row.(TYPE=="PHOTO").ID[j];
var tempMarkerRef="mrk"+tempMarkerIndex;
photoMarkersArray.push(tempMarkerRef);
photoMarkersIndexArray.push(tempMarkerIndex); -
Adding dynamic text to SharePoint Pages
Hello all,
Our SharePoint developer has quit and not his "duties" have been "pushed" onto me. While I am no developer, I can hold my own on certain things.
Basically I have been asked to add "dynamic" text to our pages that will "read" a field in our "project information list" - project name, client etc.
Is there a way to "read" a field in SharePoint and add this information dynamically to a page? Our project pages will be around 20 and to do it manually for every page would be a bit of a bear.
Lastly, we have a documentation library with folders in it. Is there a way to display the "folder" the user is currently in? Right now, when the user clicks on "procedures", there is no visual indication on the page they are in the "procedures"
folder.
Thanks all for any help you may be able to provide.
BrentHi,
It would be easier for communities focus on one question in one single thread, if you may have more than one questions, it would be better to post one question in one single
thread.
For the first question, you want to display values from a column of a list in a page, what’s more, the values will be changed along with the changes in the corresponding list.
Content Query Web Part would be a good choice without coding.
You can specify the column you want to display, the style of the content and you can even filter the values you got. All you need to do is add this web part into your 20 pages
with some necessary settings, then you will get a dynamic view of data on your page.
Display a dynamic view of content on a page by adding the Content Query Web Part
http://office.microsoft.com/en-001/sharepoint-foundation-help/display-a-dynamic-view-of-content-on-a-page-by-adding-the-content-query-web-part-HA101794897.aspx
Here is two demos about how work with the Content Query Web Part:
http://community.bamboosolutions.com/blogs/sharepoint-2013/archive/2013/05/10/how-to-use-the-content-query-web-part-to-rollup-data-in-sharepoint-2013.aspx
http://www.codeproject.com/Articles/756834/Customizing-the-Content-Query-Web-Part-and-Item-St
Feel free to reply if there are still any questions.
Best regards,
Patrick
Patrick Liang
TechNet Community Support -
How to display Dynamic text after adding flash file to html
Please help - I have a dynamic text field in a movieclip
inside a main movieclip - Within flash the dynamic text display
properly but once I load the file to an html page the dynamic text
no longer display - It loads undefined in text box. However when I
remove the movieclip from main movieclip text display no
problem.that's as2 code, not as3. please post in the correct forum
next time.
either about.txt is not in the same directory as the html
file that loads or embeds your swf or there's a case issue with
about.txt really being About.txt, for example. -
Hi,
I would like to know whether FLASH AS3 has some option to get all the files names from a folder specified and show it in a dynamic text box? Whenever some new files added to this folder it should update the list accordingly.
Thanks for any information in this regard.Not particularly experienced in this field myself, but I've found its just easier to implement an XML file which lists the contents of the folder. It just means that when you upload a new file you have to add it to the list in the xml file also. No real hardship once you figure out the mechanics of it
-
Linking a class to a dynamic text field to load XML data.
Hi,
I'm quite new to ActionScript and would be grateful for any help here.
I want to load text into a dynamic text field (called 'about_tab') using a class depending on the language selected (by clicking on a flag icon) by the user.
I managed to get this to work when the ActionScript was written directly in the timeline, but am having problems with doing the same thing via a class.
This is my class file:
package
import flash.display.SimpleButton;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.events.Event;
public class ChangeLang extends SimpleButton
public function ChangeLang()
addEventListener(MouseEvent.CLICK, switchLang);
trace("ChangeLang class working");
public function switchLang(event:MouseEvent):void
var lang = event.target.name;
var req:URLRequest = new URLRequest("languages/"+lang+".xml");
var loader:URLLoader = new URLLoader();
var substance:XML;
function xmlLoaded(event:Event):void
trace("function xmlLoaded is running");
substance = new XML(loader.data);
about_tab.text = substance.about_lbl;
loader.addEventListener(Event.COMPLETE, xmlLoaded);
loader.load(req);
Here's one of my XML files (the other is the same except "About" is written in German):
<substance>
<about_lbl>About</about_lbl>
</substance>
When I run it, it returns my trace statements that the class ChangeLang and the function xmlLoaded are running, but no text appears in the dynamic text field (I should/want to see the word 'About'). I get this error message:
1120: Access of undefined property about_tab
The problem, I'm guessing, is in the part in red in my code. I think I need to target the text field in the display list by creating a reference to it. If so, could someonw point out how I do this, or perhaps a tutorial that would help. I've tried adding the word stage (i.e.,stage.about_tab.text = substance.about_lbl; ) but it still doesn't connect. I guess there's something really simple I'm missing, so I apologize if this comes across as a stupid question
Thanks for any help.Hello flashrocket!
I'm also new to AS3 and I've just started using external classes and I think I know what you should do to put your code to work.
Instead of using the text field you created inside your flash file, why don't you use the "TextField" class to create an instance of this object? It's the exact same thing as when you create and instantiate a new text field inside Flash.
First, import flash.text.*; (includes classes like TextField, TextFieldAutoSize, TextFormat, TextFormatAlign, etc)
Than you just have to create a var like
public var about_tab : TextField;
or
public var about_tab : TextField = new TextField();
then, to adjust the properties of this tab you use dotsyntax as if it where on your stage like:
about_tab.x = 50; about_tab.alpha = .5; etc...
you can even create a function to "config your textField"
private function createAndConfigTextField() : void {
about_tab = new TextField(); //you only need this line if you
// only typed something like "public var about_tab:TextField;
// if instead you used "public var about_tab:TextField = new TextField(); outside
// this function, just skip this first line because you already have an instance of
// text field named "about_tab"...
about_tab.autoSize = TextFieldAutoSize.CENTER;
about_tab.background = true;
about_tab.border = true;
var aboutTextFormat : TextFormat = new TextFormat();
format.font = "Arial";
format.color = 0x000000;
format.size = 11;
format.bold = true;
format.align = TextFormatAlign.CENTER;
about_tab.defaultTextFormat = aboutTextFormat;
addChild(about_tab);
This is just an example of what you can do... I hope you get it... let me know if you have any doubt... -
Linking Dynamic text boxes?
Hi there,
This might be straight forward, but I would like to know how could one link dynamic text boxes so that the information would flow? In a way, the information would flow from:
(XML) Input A into BOXA00, BOXA01, BOXA02, BOXA03, etc.
(XML) Input B into BOXB00, BOXB01, BOXB02, BOXB03, etc.
(XML) Input C into BOXC00, BOXC01, BOXC02, , BOXC03, etc.
Any takers?Hi i recently have made a function that can calculate the amount of text that will fit into a specified text box. See my attached file. Notice that the box will only accommodate the text in red since that is the maximum it can display.
"This here one is a very very very long long long text that cannot really fit completely into this box so we will have to cut it at some index point"
My function getTextExtent will return an object with properties
nIndex -> which determines the index at which the text will be delimited
fExceeded -> is true if the text is longer than the allocated height of the text field. -
Create a Link using Dynamic Text and Capture Variable
I am building a dynamic website using Dreamweaver CS5 with Coldfusion 9
Currently I have created a dynamic text table. The table is created by querying the Invoice table and displays the all the customers Invoices. The columns Include Invoice #, Date, Amount Paid, BalanceRemaining, Due Date. So basically lists all the invoices I have applied to the unique customer. It is pulled up using a session variable I created from the login page.
My question is this I want to make the "Invoice #" linked so when you click on it it goes to a new page and performs a new query which retrieves infro related to that specific invoice such as Services Rendered, Service Description, Date, Price, Total. I was able to create a link to the Invoice # but I am stuck trying to figure out how to capture the Unique Invoice # and apply it to the new query. Is this possible if so how?
Thanks for your help!Now keep in mind I am speaking strictly from a web and SQL standpoint as I have no experience with coldfusion.
If you are able to create the link to the Invoice, I am perceiving this as the following:
Invoice
Links to
#123
page.php?invoice=123
#345
page.php?invoice=345
If your page is setup like that then you already have the data stored in the browser request with the GET method. In PHP the equivalent is the $_GET array. I am assuming ColdFusion has a similar array to work with forms. Then on your following page you obviously need to check that the visitor came from the prior page with the proper permissions to ensure that someone doesn't get the address page.php?invoice=### and just guesses through and views all invoices if they are not supposed to. Then your query would look something like the following:
SELECT * FROM invoice_table WHERE invoice_number = $_GET['invoice']
Remember this in written in PHP so yours should be a similar equivalent.
Hopefully this helps a little to get you going in the right direction. -
Dynamic Text and changing Text in AS3
I have a Dynamic Text box in my Library. I drag it to my main stage and give it a name..it is now a movieclip. The name is 'mcAdmin'. I added an event listener for MOUSE_OVER. I want the text to change color, but for now I'm just trying to change the text; however, it's not displaying the change in text I want. I do a trace, and the change is in there on the output window, but it is not displayed as such. How can I :
1) use AS3 to change the font color of the text
2) use AS3 to change the text and have it display?
function onMouseOver_txtAdmin(e:MouseEvent):void
Mouse.cursor="button";
//Current mcAdmin text is 'Administration'
//I want to change the color of Administartion on Mouse_Over
//but to test if I can get to anything, I'm just trying to change the text.
mcAdmin.text="Hello";
trace(mcAdmin.text);
mcPPMB.alpha=.5;
mcASB.alpha=.5;
mcISO.alpha=.5;
mcEA.alpha=.5;
mcAdmin.alpha=1;
mcAdmin.scaleX=1.25;
mcAdmin.scaleY=1.25;
Thanks.1st
give the textfield a name, if it hasn't already (sounds like you put it in a movieclip).
to change the text set the text property of your text field
like this
myTextField_txt.text = "here is the text";
or if it is inside a movieclip
myClip_mc.myTextField_txt.text = "here is the text";
To change the color you would need to put a TextFormat on it. To keep the same fontsize, font etc. you could first get the TextFormat from your existing Textfield, change the color of the TextFormat and set it on the TextField.
// get the Textformat of the first character
var TF:TextFormat = myTextField.getTextFormat(0,1)
// set the font color
TF.color = 0xff0000;
// put it on the whole text
myTextField.setTextFormat(TF) -
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. -
Dynamic text doesnt appear chinese word!!!!
dynamic text doesnt appear chinese word.
i have try to set to arial unicode but still cant.
Pls help.
THxI change that line but is the same result....
If I have one event it look like this:
and if I fill all events look like this:
as you can see it doesnt align vertical....its the same alignment on the two images.... here is my code again...
var urlLDR:URLLoader=new URLLoader();
urlLDR.addEventListener(Event.COMPLETE,f);
urlLDR.load(new URLRequest("hallsXML.xml"));
function f(e:Event) {
var xml:XML =new XML(urlLDR.data);
TXThall.autoSize = "center";
TXThall.text = "";
for(var i:uint=0;i<xml.hall.length();i++){
TXThall.appendText(xml.hall[i]+"\n");
TXThall.y= Math.floor((stage.stageHeight - TXThasll.textHeight) / 2);
My page size of the project is 768 * 1024 and the position & size of the dynamic text is X: 384.0 Y: 332.5 W: 664.0 H: 405.9...
I dont know if it helps that data....
Thanks for responding and I hope you can help me figure out this... -
Dynamic Text with external .txt files
I need help getting dynamic text to display. I've used the
following tutorials (among others).
http://www.kirupa.com/developer/mx/dynamic_scroller.htm
http://www.kirupa.com/developer/mx/multiple_dynamictext.htm
In Flash 8 on last frame of maintimeline of movie, I have a
layer with a background image, 2 buttons and a dynamic textbox
(made scrollable) with scrollbar component. Textbox is given a var
of "content", and an instance name of "textBox", which is
referenced in scrollbar parameters.
I have created 3 text .txt files, and saved them to same
folder with movie .swf file. Text in files is preceeded by
"content=" on line preceeding text to correspond with var of
dynamic textbox. The files were created in Rich text format on Mac
OSX4.11 and saved with .rtf extension, then file extension was
changed to .txt (wouldn't save as .txt)
I've added the following actionscript to this last frame:
loadText = new LoadVars();
loadText.load("TEXTintro.txt");
//creating the loadVarsText function
loadText.onLoad = function(success){
if (success){
textBox.text = this.content;
else{
trace("Error loading external content");
Buttons have an instance name assigned with the following
actionscript:
on (release) {
loadText = new LoadVars();
loadText.load("TEXT1.txt");
loadText.onLoad = function(success){
if (success){
textBox.text = this.content;
else{
trace("Error loading external content");
When I test movie, I can see buttons on last frame of movie,
but they don't load any text when pressed, and "undefined" text
appears in upper left corner of text box before I press either
button.
I am getting the following Output errors:
**Error** Scene=MoonOfWintertime, layer=TextBox,
frame=2500:Line 1: Statement block must be terminated by '}'
on (release) {
**Error** Scene=MoonOfWintertime, layer=TextBox,
frame=2500:Line 11: Syntax error.
**Error** Scene=MoonOfWintertime, layer=TextBox,
frame=2500:Line 1: Statement block must be terminated by '}'
on (release) {
**Error** Scene=MoonOfWintertime, layer=TextBox,
frame=2500:Line 11: Syntax error.
Total ActionScript Errors: 4 Reported Errors: 4No more output errors, buttons still not working, but I got
my intro .txt file to load in textbox that loads with frame using
the following code I tried from another tutorial:
loadText = new LoadVars();
loadText.onLoad = function() {
textBox.html=true;
textBox.htmlText = this.textContent;
loadText.load("TEXTintro.txt");
Tried the following code with buttons, but doesn't work.
Other code suggestions?
on (release) {
loadText = new LoadVars();
loadText.onLoad = function() {
loadText.load("TEXT2.txt");
on (release) {
loadText = new LoadVars();
loadText.onLoad = function() {
textBox.html=true;
textBox.htmlText = this.textContent;
loadText.load("TEXT1.txt");
}
Maybe you are looking for
-
Clicked articles won't open up.
Clicked on "Storms to hit major U.S. cities. Window opens, but video screen remains a black bar across the bottom. It seems to be happening more often.
-
This will not work. I can connect to TV using VGA connection. I can connect other devices to TV via HDMI but not the Q190. Any suggestions? Thanks
-
Converting from printlayout to pdf file
i converted the printlayout to pdf but in that pdf it didnt shows the images (but logo was existing in the layout) i need the solution as soon as possible regards kavitha s
-
Exchange 2010 Certificates, IPs, and Domain Names...
I'm setting up a new Exchange 2010 server, migrating from an old Exchange 2003. I'm at the point now where I'm stuck and cannot move the mailboxes of the users to the new server until I get the new server setup with certificates, reconfigure the fire
-
Unsupported content type in editor
Hi everyone, I just joined the Flex world from the Flash world. I installed the Eclipse plugin and got this error when I tried to open an MXML file. Unsupported content type in editor. Please change the file extension association..blah..blah.. When I