flash actionscript:
what am I mising? 1. i have a one frame flashmx file. 2. frame action is as follows: loadVariables("readme.txt", ""); stop(); 3. dynamic text field built, variable named textHere 4. dragged the scrollBar component to this text field, it auto named the text field instance to InstanceName_0, and targeted itself to that text field. 5. test the movie. 6. The text field is filled (as much as field will allow) with text from the external file. good and fine. 7. scroll bar is visiable, but no scroll functionability. I cannot scroll the text. How come?
thanks for the point in the right direction Jack. After some more research at a local bookstore, and the tech note you provided, I see now that what I want accomplished will take a good deal more scripting. the scrollBar component, while good, only works on text entered into the dynamic text field, not text loaded into it.
hmmm....create a few text files ( containing &txt=blah,and more blah.....the end& ) load a Scrollbar to the Library by dragging to stage and deleting, add buttons to stage, giving them instance names, add this code (MX) to load the textfiles and attach/size the textfield/scrollbar, tgt = this; function display(file,h,col1,col2){ lv = new LoadVars(); lv.onLoad = function(){ tgt.createTextField("tf1", 10, 50, 50, 210, h); tf1.multiline = tf1.wordWrap = tf1.border = true; tf1.borderColor = col1; tf1.textColor = col2; tf1.text = lv.txt; tgt.attachMovie("FScrollBarSymbol", "scr", 11); scr.setSize(h); scr._x = tf1._x + tf1._width; scr._y = tf1._y; scr.setScrollTarget(tf1); }; lv.load(file); }; btn1.onPress = function(){ display("first.txt",80,0xff0000,0xff0000); }; btn2.onPress = function(){ display("second.txt",100,0xff00ff,0xff00ff); }; btn3.onPress = function(){ display("third.txt",40,0x0000ff,0x0000ff); }; display("first.txt",80,0xff0000,0xff0000); stop(); hth regards
Dear all, I have some problems in using textfield and scrollbar component. I add a textfield and scrollbar dynamically. But the scrollbar can't work with the textfield. Here's the code: this.createTextField("temp", 1, 0, 0, 50, 50); this.attachMovie("FScrollBarSymbol", "scroll1",2); scroll1._x = 50; scroll1._y = 0; scroll1.setSize(50); scroll1.setScrollTarget("temp"); temp.wordWrap = true; temp.text = "dfadsfadsfasdfadfadfadfadfafadfadfadfadfadfadfadfaffsdfsdfdsfdsfsdfsdfsdf"; stop(); Could someone here tell me the problem? Thanks! Best, Alvar
tested in MX, remove the quotes from the target scroll1.setScrollTarget("temp"); - to - scroll1.setScrollTarget(temp); does this work for you ? regards
Dear Jack, Yeah! It works in Flash MX 2004! Great thanks! Then it's an error in the documentation of Flash MX about this! Best, Alvar
Don't see what you're looking for? Try a search.
|