Nutrox, Or Other Coders Pls Help With FBF
Hello, please can you help me with modification in my reposition script (in full browser flash)? I have read some articles about functions & methods in actionscript, but I still don't understand them (how it works, how works looping in functions...)
I have Flash XML Image Gallery from Nutrox (this script), and something like this (resizing script from this gallery) I want to apply in my reposition script.
My reposition script is this (it works properly) and I’ve been trying to apply Nutrox resizing script from XML gallery to this - I wanted to repose movieclip without use of any other script (classes, flash libraries, mx.transitions etc.), but it didn't work – I’ve tried more versions (this is the lastest) and none of my versions didn't work
I would be grateful if you could give me some useful advices. Thank you very much for your attention.
Best regards Robert.
Ultrashock Forums > Flash > Flash Professional
Posted on: 2006-04-20
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Nutrox Needs Your Help
Hi guys.
I've been asking this question for a while now but I still haven't had a clear "yes" or "no" answer.
Does the LocalConnection class have the same problems as LiveConnect in that it doesn't work on Macs?
I have created a small on-line test that you will find here in the hope that some Mac users (with either IE or NS) will be able to try it out.
If you want to know how it works the AS I used in both test movies is this..
ActionScript Code:
var self:MovieClip = this;
var my_lc:LocalConnection = new LocalConnection();
this.my_lc.connect(id + "_lc");
this.my_lc.update = function(arg:String):Void
{
self.words_txt.text = arg;
}
this.words_txt.onChanged = function():Void
{
var brother:String = self.id == "one" ? "two" : "one";
self.my_lc.send(brother + "_lc", "update", this.text);
}
..yep, that's all there is to it.
Thanks in advanced guys.
Si ++
Follow-up On Grid: Nutrox Please Read (others OK)
I have been trying to modify this code that I have for making a grid that responds to keyboard commands (Nutrox got me going and I have made a few changes). As it is now, I can use the right arrow key to move left to right, but I need to add in the left arrow key as well as up and down. I also have two dynamic boxes on the bottom that show x and y coordinates of the selected circle. I do not know how to get these to link up with the grid.
Test Grid
Zip file with fla, htm and swf. Flash 8 file.
I hope this makes sence. One other thing, you need to click in the upper left corner to activate the motion in the grid. Ultimately I would like the grid to start working right away without me having to click anywhere. Also, I would like to enter in an X and Y value and have that become the active circle to procede from that point.
Thanks for your help folks!
Nutrox's Full Browser Flash With Swfobject...
Hi guys,
What I want is a centered flashsite with a seamless bg pattern. To do this, I could make my site following Nutrox's directions in this Full-Screen Centred Flash, but the problem is that I always use the swfobject to add my flashcontent to an htmlpage, because I want the functionality of flash player detection.
Now, the way I add my flashcontent is:
<script type="text/javascript">
var so = new SWFObject("plenss.swf", "movie", "100%", "100%", "8", "#FFFFFF", true);
so.addVariable("flashVarText", "this is passed in via FlashVars for example only");
so.addParam("scale", "noscale");
so.addParam("menu", "false");
so.write("flashcontent");
</script>
This also gives me a full browser flash site, but also gives me the functionalty of the swfobject.
The only problem is that I dont know how to add a seamless background pattern to this while the rest of the site stays centered.
Is there anyone who can tell me how to do this?
Thanks!
This Ones For All The Coders
hey guys ...
hope ure all doin well!!
ok basicall the thing is that ive got a fla file with 8 frames....now ive got it workin do that frames 2-10 play in a random order each time a button on that frame is pressed.. until all 8 have been played once...at which point the user is directed to the frame('quiz1end')....
thats fine..
but now what i wanna do is when i click the button on the frame.. a movieclip on the frame plays and then it goes to the next random frame...or quizend frame (if all 8 frames have been played once....
this should be simple enough as the only thing im doin is taking out the random code in the button and putting it on the last frame of the movie clip but its not workin...
i hope you understand what im tryin 2 say here!!!!
ok heres the code on the first frame of the file (this function randomly sends the user to another fram until all 8 frames have been played)
function shuffle() {
var j, k;
var tempo;
for (j=0; j<a.length; j++) {
k = Math.floor(Math.random()*a.length);
tempo = a[j];
a[j] = a[k];
a[k] = tempo;
}
}
shuffle();
//trace(a)
step=0
function nextchoice(){
_root.gotoAndPlay(a[step])
}
nextchoice();
ok guys now heres the code on the button ( when i put this on the last frame of the movie clip instaed of the button it doesnt work!!!) :-
on (release) {
//this bit needs to go into the last frame of the movie clip instead of in the button so it plays the mc before goin onto the next frame
if (step>7) {
_root.gotoAndStop("quiz1end");
} else {
_root.gotoAndPlay(a[step]);
}
}
how do i change the button code(above) so that i can put it on the last from of the movie clip instead and it will still go to the next random frame!!!
i look forward to your positive response
many thanks !!!...
Call For Coders
Hey !!!
( I also opened this topic in the game forum, i opened it here too, since it is adressed to coders, not nessecarly posting in game forums )
Once again, a topic about Two Kingdoms, but i hope this one will be more productive than the last one.
Resettling in France took me quite a long time, but now, for real this time, i have my nights and week-ends back for Two kingdoms : today, i started to work again on the third cutscene, and i will work on it all day tomorrow
So, of course, i want to know if some people of the past team, or new ones want to join the project : of course, what i need the most are coders, since the code of the game is far too evolved for me...
Though, let me stress few things
- of course people should be dedicated to see the project end within three months : it's been too long of a developpment now, and i really want to see that game finished : i'm willing to work as hard as it is possible on new tiles, new enemies and new cutscenes, but the coders have to follow too, and be able to set a proper AI, fight system in a reasonnable deadline, without reprogramming everything : a lot have been done already, it might not be perfect, but let's keep what's existing for now
- Please be motivated AND available : by this, i mean, think hard before joinning : students or workers that know that they will have exams, projects that will need all their time soon should privilege this : it is too much a loss of time and energy to have to re-contact people, organize deadlines following the availabitity of everyone
- When i say that i REALLY want to see the game finished within three months, i mean it : i am currently interviewing coders that i know to hire one for the project - when i mean hire, i mean money - since it is a personnal project, i cannot spend too much, but if paying someone garantees the seriousness and the involvment, i am willing to
Though, if i am paying for coding service, it seems obvious that the weight the coder will have in the credits will be lowered : it is up to you and on how much you believe in the project. join for free and be a full actor of 2K or make your price
If there is a renumeration, it will happen ONLY at the end of the project, since i don't want to pay for half-written code ...
I remind you that i'm not a company, nor representing one, so the "contract" that i'm proposing will certainly lack a lot of things : if there are specific points to be discussed, i'm ready to discuss them
Understand me : i would prefer to have partners with whom i could share the adventure, instead of having to pay someone : i'm not rich, and i think these type of projects should be done by a strong team that is willing to risk some personnal time, but, even more than that, i want to see the project finished !!!
- 2K is a serious project : once it's finished, i want to show it to various heavyweight flash actors : it can actually generate some buzz, articles, or money or who knows...
Of course, if you see yourself as a partner, i am more than willing to share all of this, but if i pay for the code, i will solely negoc
iate with interested people, and nobody else will be involved in the future of the game.
The reason why i'm ready to invest some money is because i think this type of product can interest some people, i might be wrong, but i could also be right : however i do not want to force anybody to take the risk
- What's done, and what's yet to do :
-> Done
1) The map navigation, scrolling, building, generation already exist (Ed Mack and Jeroen were coders for the engine and the navigation ) i was the one for the map generator ( inspired from a tutorial from Jail***** )
Sorry Tomsanson, but i have been waiting the final version of your generator for so long now that i've decided that keeping mine will save a lot of precious time and involvment for the project : i want to give priority to additions to the game, and not changes anymore.
2) GFXs and tiles : around 150 different tiles and three different characters have been created : more to come, of course
cut-scenes : two are complete, one is currently in progress, six more are yet to be done
3) inventory and quest system : are existing, though i think they could (should ?) be improved
-> to be done
1) player stats system : mostly a mana and health bar + experience points
2) fight system (arcade type, think Gauntlet for example) : one for the player (involving different weapons) and several for different type of enemies
3) a good AI system, that can be parametered differently according different type of enemies ( for example with such parameters as intelligence and speed to have differences between the enemies )
4) a "save" system : so that basicly people can save their parameters in a database so that they don't have to play the game in one shot : it doesn't need to be precise : just saving the stats, inventory and the number of the map is enough
5) help to wrap-up the final product : call by cript the cutscenes when needed etc etc ... though i should be able to handle this without too much problems
I have quite a precise idea of what i want, but ideas are welcome as long as they do not interfer with the project deadline
Well, that's about it
I will finish with the usual links for you to check the state of the project:
(Watch out, content is quite heavy, so for broadband only)
the site so far (including forums) -> http://grafikdezign.free.fr/
When the game will be finished, i will put up together a much nicer site !
the alpha version of the game -> http://grafikdezign.free.fr/game/game.htm
the first cutscene -> http://grafikdezign.free.fr/teaser.htm
the second one -> http://grafikdezign.free.fr/teaser2.htm
For those interested, please reply in this topic
Thanks,
LUX
AS Coders, Please Read
Hi...
I wanna learn AS, but unfortunately I cannot do it alone... And please dear forum members, let me explain my self a little beat:
I am from Bucharest-Romania, and here is very hard to get to know people who know how to write code, and who knows hardly wannna shear..! Here the paychecks are really small, and you may not believe me but I work for ~150$/month!! In this situation of course you realize that a cable connection is not accessible for me (at approx 30$/month in my area..!) I only can afford to have mail and some forum posting from my home, with a dial-up connection!
However I have an ISDN connection at my work and I can sometime check the net for game sources (my great passion- building games in flash). I only need some persons who can give me a little beat more attention and who can answer to my newbie questions like "how to build this, and that...".
Like a first thing I wanna learn is how to simulate gravitation on a ball! I founded some .fla's on the net but I want somebody to shear how do you put your thoughts to AS? If you want to build an MC with a ball who bounces and simulate gravitation, how will you do it?
I must say that I am familiar with the Macromedia Flash MX tutorials and I use flash for web design, (www.ennstudio.ro and www.unitedcom.org are build by me)
.................................................. ...............
Please, please if you have the know how and the time and the will to help me, DO IT as I wanna learn!
If you lack the above qualities, and you wanna learn, just like me... stick to this thread, be cause you mite actually learn something!
THNX for reading this post,
ovidiu
Coders HELP Clean This Up
OK this is the rollover code for a drop down sub menu.
It kinda works except the prevFrame doesnt seem to work and it seems excessive code.... especially when I have 5 buttons and id have to do this 5 times!!!
Code:
_root.menu_mc.multiBut.onRollOver = function() {
if (_root.dropMenu._currentframe<53) {
_root.dropMenu.onEnterFrame = function() {
_root.dropMenu.nextFrame();
if (_root.dropMenu._currentframe == 53) {
_root.dropMenu.onEnterFrame = function() {
_root.dropMenu.stop();
if (_root.dropMenu._currentframe>53) {
_root.dropMenu.onEnterFrame = function() {
_root.dropMenu.prevFrame();
if (_root.dropMenu._currentframe == 1) {
_root.dropMenu.onEnterFrame = null;
}
};
}
};
}
};
}
};
_root.menu_mc.homeBut.onRollOver = function() {
if (_root.dropMenu._currentframe<79) {
_root.dropMenu.onEnterFrame = function() {
_root.dropMenu.nextFrame();
if (_root.dropMenu._currentframe == 79) {
_root.dropMenu.onEnterFrame = function() {
_root.dropMenu.stop();
if (_root.dropMenu._currentframe>79) {
_root.dropMenu.onEnterFrame = function() {
_root.dropMenu.prevFrame();
if (_root.dropMenu._currentframe == 1) {
_root.dropMenu.onEnterFrame = null;
}
};
}
};
}
};
}
};
Help me coder gods!
Zooming For Non Coders
hi:
I'm looking for a way to easily zoom through a series of images. I'm not a scripter and basically need a solution for dummy's. Any suggestions?
Kayakrazybc
Need Coders Help About A Shoot'em Up
i modeled a cute spaceship
and i made sketch of a Rtype like game...
here is the swf
i need some help about cleaning the code
if u want to help me, ask for the fla...
peace
A Question For Compact Coders
Hello,
I have values for two x and y, stored in a text file:
x=0,1,2,3,4,5,6,7,8,9,10&y=7.39,7.54,7.50,7.312,7. 00,6.61,6.16,5.69,5.21,4.75&xyLoaded=true
I have writen actionscript to split each of these arrays:
//xArray = x.split(",");
//yArray = y.split(",");
However, I now need use a .txt file with many more variables, a,b,c...y,z. Rather than copy the above code again and again, I want a more elegant solution. This is what I have tried so far, but its not working and I cant figure out why:
_global.splitArray = function (array){
variableName = array+"Array";
variableName = array.split(",");
}
arrayList = new Array("x", "y");
for (jj=0; jj<=1; jj++){
splitArray(arrayList[jj]);
}
I thought it might come to me over the weekend but it hasn't, can anyone help me out with a compact solution or spot my mistake??
Thank You,
Tim.
Hardcore Coders...experts...please Help
I need these pictures to stop scrolling when it rolls out of the masked area. It's eating up my CPU usage, it jumps to 98% when those pictures are loaded.
site
FYI. those pictures are buttons leading nowhere right now. And the site has no preloaders yet.
here's the fla for just the pictures scrolling. The blue screen is on another level
fla
thanks in advance
Expert Coders Required
Hi:
I am creating a presentation with 5 slides.. (labeled 1 through 5) with audio. I am giving users an option of seeing the text that is spoken in the audio by clicking a text button which calls a movie clip with a dynamic text field (reads from a text file)..
Now the problem...
When the movie enters frame label 2 how do i update this text field?
I have attached a zip file with an example of what im trying to acheive.. any help is greatly appreciated
Seek Advanced Coders
I have been using flashkit.com for over a year, but as you develope your own skills, you realise that the questions on the board is very much the same as for one year ago.
I wanna ask, if some of you guys would like to team up and make a homepage with advanced tutorials for the real issues about flash. (Instead of "How do I make my man walk?")
What ya say, guys?
Freelance Coders - Ethics ?
I am more than happy to help people who are stuck with AS, its syntax and implementation.
Occassionally I am asked to undertake projects for commercial use.
I'll receive the usual emails - we are honest, xx yrs in business, small
returns from this initial project but on completion the client will send
more work our way and you WILL get paid....etc
After recently completing a rolling ad-banner (text file driven for
easy editing) I heard zilch for 3 weeks, so contacted the client
and informed him that the file contains a date-comparitor and
would cease functioning after April 1st ( i had not included the
comparitor, but felt this would gain his attention )
His response was that i was acting unethically, my response was
that i was sick of being ripped off !!
How do other freelance coders protect their work from abuse ?
Natural Born Coders
a little offtopic:
just curious, how many of you guys were born
with coding in blood? i mean... have you ever had moments like im having right now, when i feel like i dont understand a damn thing from this actionscript language, and i feel like pulling my hair out? or is it just me, that im having a problem, and all of you are simply viewing thru the code like its in your blood?
how long did you guys took to learn all of this?
Mouse Restriction...hardcore Coders Please Help
I'm developing this menu
http://www.nhglink.com/tempFolder/angie/indexMenu.html
but I want the pictures to stop scrolling when it is outside the red box that you'll see there, but I have no clue how to do it.
this is the code I'm using
// -------------------------------------------
// MAKE THE DRAG WORK
// -------------------------------------------
// SET DRAG SPEED (inverse)
speed = 25;
drag = "/dragControl";
/:w = getProperty("/nav", _width);
/:xPos = getProperty(drag, _x);
/:yPos = getProperty(drag, _y);
// next line centers the menu drag to the screen
//:xPos = 635;
/:xPos = /:xPos -(1260/2);
setProperty ("/nav", _x, getProperty("/nav", _x)-(/:xPos/speed));
if (Number(getProperty("/nav", _x))<Number(-(/:w/2))) {
setProperty ("/nav", _x, 0.01);
} else if (Number(getProperty("/nav", _x))>0) {
setProperty ("/nav", _x, -/:w/2);
}
Any ideas. Thanks in advance
2advanced Clouds...hardcore Coders Help Please
Hi all,
I found this tutorial for the clouds used in 2A. I want to use this same concept with another image sequence but I'd like to know how to add a preloader so that the first image stays there until the last one is loaded. That code is chinese to me.
Please help!
clouds
Any Hardcore Coders Wanna Take A Stab At This?
1st frame:
// Initialize particle
this._x=_root._xmouse;
this._y=_root._ymouse;
this._visible=true;
// Initialize X and Y velocities
vx = (random(3)-1)/5;
vy = (random(3)-1)/5;
// Set number of loops particle will live
life = 70;
2nd frame:
// Get current position and add XYVelocities
curx = getProperty("", _x);
cury = getProperty("", _y);
this._x=this._x+vx;
this._y=this._y+vy;
// Alpha is dependent on proximity to death
ap = 100*life/70;
this._alpha=ap;
this._xscale=ap;
this._yscale=ap;
// Eratic behavior closer to death
vx = Number(vx)+Number((random(51)-25)/ap);
vy = Number(vy)+Number((random(51)-25)/ap);
// Reduce particle life
life = life-1;
if (Number(life)<0) {
// Life counter is up, remove particle
this.removeMovieClip;
stop ();
}
3rd frame:
// Repeat until particle is dead
gotoAndPlay(_currentframe-1);
What I am looking to do is start at object a and end at object b with a slight arc to it. This is coded for a mouse click. I have inserted about 40 diffrent commands and cannot seem to get this thing to work. I am more a designer not a coder, so as you can presume, I am quite lost in this!
Thx in advance for your help!
Recruiting Good Coders For Games
hi there!
My team and I are recruiting coders for a strategy RPG game already undeway...our main coder had to leave the team for certain reasons and we are looking for new talent. If you are interested, please send an email to
dfteam@darkflaredigital.com
The prerequisits are as follows:
Have played Strategy RPG's before
Very good knowlege and coding experience with Actionscript.
Thank you!
Tricky Question For Experienced Coders
Hey everyone
I'm trying to figure this one out, but it's pretty tricky. I'm making a site, where you can practice music theory, and within this site there's a section, where you can learn to hear what type of interval that there is between 2 tones. I have mp3 files with these tones: (if you don't know anything about music, it's just a bunch of tones where the following is 1 halftone higher than the previous)
Mp3 file # 1: C
Mp3 file # 2: C#
Mp3 file # 3: D
Mp3 file # 4: D#
Mp3 file # 5: E
Mp3 file # 6: F
Mp3 file # 7: F#
Mp3 file # 8: G
Mp3 file # 9: G#
Mp3 file # 10: A
Mp3 file # 11: Bb
Mp3 file # 12: B
Mp3 file # 13: C (in a higher octave)
Mp3 file # 14: C#
Mp3 file # 15: D
Mp3 file # 16: D#
Mp3 file # 17: E
Mp3 file # 18: F
Mp3 file # 19: F#
Mp3 file # 20: G
Mp3 file # 21: G#
Mp3 file # 22: A
Mp3 file # 23: Bb
Mp3 file # 24: B
Mp3 file # 25: C (in yet a higher octave)
What I want flash to do, is to select 2 files to play: 1 random MP3-file between #1 and #12... and after that it has to randomly select one of the files that is between the number of the first selected file and the following 11 files. Flash must not play for example file # 1 and then play file #24, because the intervals are too far from eachother. It has to be an interval of no more than an octave (that is from C to the following C, 11 tones higher). So if flash selects file # 3, the second file has to be from file #3 to file #14
What is teasing me even more is that the user has to be able to select which intervals he wants to practise. So if he chooses that he only wants to practice the second and the third tone in a scale, flash still has to select a random number between file # 1 and #11, and then when it has to select the other file, it has to randomly select between the 2 files that he has choosen to test himself in...
Are you following me? Help would be much appreciated....
thanks - from Ronze
XML And Flash. Great AS Coders Like You Sure Can Give A Hand ;)
Hi there,
I've downloaded a few tutorials on the subject but I'm still stuck on this XML problem. Hope you can help.
The xml file:
Code:
<?xml version="1.0"?>
<menus>
<main id="1">
<name>WORKS</name>
<submenu>
<name>BONET HOUSE</name>
<loadname>bonet</loadname>
<pages>4</pages>
</submenu>
<submenu>
<name>GYM</name>
<loadname>berger</loadname>
<pages>3</pages>
</submenu>
<submenu>
<name>WAREHOUSE</name>
<loadname>warehouse</loadname>
<pages>4</pages>
</submenu>
</main>
</menus>
The structure is quite simple. I have several MAIN MENUS (just wrote one for the example) with a name tag and several SUBMENUS each, the number changes in each MAIN MENU. For every SUBMENU I have some tags with data in order to build up the page.
What I want to do:
1- An ARRAY VARIABLE holding the NAME of each MAIN MENU.
2- A VARIABLE for each MAIN MENU called "mainX" (where X is the number of that MAIN MENU) that contains a number showing the number of submenus in that MAIN MENU tag.
3- An ARRAY VARIABLE called "mainXsubmenuY" (where X is the number for the main menu and Y the number of the SUBMENU) holding the data for the SUBMENU (the values in the 3 tags)
For what I've seen so far Flash (using 5 at the moment) enconters problems if the xml document has either carriage returns or white spaces, but this makes the file much easier to edit. I know that it is possible to "ignore" that kind of troubling data, but I just don't know how.
But so far I couldn't do any of the previous, so any help on the matter will be really appreciated. Thanks so much for your time and advice.
Castaway
Simple Question - I'm Having A Bit Of A Coders Block Today
Trying to use this code in a class to populate an array and set instances to invisible. Trying to make it so no matter how many are on stage it counts them all. Right now it stops at 2 starting at 0. Any ideas? Help? Suggestions? Thanks.
I get this error:
ReferenceError: Error #1069: Property visibleMC3 not found on com.amatrol.int.template.Visible and there is no default value.
at com.amatrol.int.template::Visible/::startOff()
at com.amatrol.int.template::Visible$iinit()
Code:
private function startOff():void {
for (var i:Number = 0; this["visibleMC"+i]; i++) {
//this["visibleMC"+i].visible = false;
MCArray.push(this["visibleMC"+i]);
//this["visibleBTN"+i].visible = true;
BTNArray.push(this["visibleBTN"+i]);
trace(i);
}
trace(MCArray);
trace(BTNArray);
}
Animated AS Rope [HARDCORE AS CODERS NEEDED]
I know this has been done before, but has anyone created a rope with realistic movement & gravity using segments, each attached at pivot points relating to their "parent" segment? Just like a chain actually. I had a few thoughts, but it would be great if someone who's worked with similar things to give me a few pointers. Thanks in advance!
[James]
WANTED: ActionScript Coders To Test Scripting In SWiSH 3.0
Hello all,
SWiSH 3.0 is getting close to release, and we're looking for experienced ActionScript coders to play with it and give us some feedback.
Now before you all jump up and down and tell me SWiSH is a toy and it will never do what Flash MX does, I agree, that's not what we're trying to do with SWiSH. SWiSH is designed to be an easy-to-use and affordable alternative to Flash (remember, we're only asking $50 for SWiSH) With this new version we've implemented some of the Flash ActionScript language (but not all of it) and we've tried to keep the syntax simple so its accessible to inexperienced users.
What's in it for you? Well, you get a free preview of an alternative Flash authoring tool (and the only commercially successful alternative now that LiveMotion is no longer in development) and who knows, you might find some of the new features useful
If anyone is interested, please contact me at david.michie@swishzone.com
Cheers, David.
Lynda.com Tutorial Gone Arye, Class Coders Needed
I am working on a class Tutorial from Lynda.com
if anyone has worked on this or can help it would be greatly apprieciated.
These functions are suppose to change to the Title text from one color to another when onPress triggered.
The problem is that the changeStyleClass() is malformed or the selectBook() isn't working. I really don't know. I've ripped over and over this, even re typed it twice. I'm sure I spelled something wrong.
Let me know, please.
Josh
files
http://www.joshspoon.com/class.rar
Problem Areas
TextUtilities class
Code:
public static function changeStyleClass(tField:TextField, sClassName:String):Void
{
var sText:String = tField.htmlText;
var nStartIndex:Number = sText.indexOf("class='");
var nEndIndex:Number = sText.indexOf("'", nStartIndex + 7);
trace('nEndIndex: ' + nEndIndex)
var sPreceding:String = sText.substring(0, nStartIndex + 7);
var sFollowing:String = sText.substring(nEndIndex);
trace('sFollowing: ' + sFollowing)
tField.htmlText = sPreceding + sClassName + sFollowing;
//trace(sPreceding + sClassName + sFollowing);
}
Book4.as
Code:
mcBook.onRelease = function () : Void
{
var nID : Number = Number (this._name.substr (6));
selectBook (nID);
//trace ("nID is " + String (this._name.substr (6)));
}
}
}
function selectBook (nID : Number) : Void
{
nSelectedID = nID;
tDescription.htmlText = "<span class='description'>" + lbOnlineBranch.collection [nID].toString () + "</span>";
var tBook : TextField;
for (var i : Number = 0; i < lbOnlineBranch.collection.length; i ++)
{
tBook = this["mcBook" + i].tBook;
if (i == nID)
{
TextTextUtilities.changeStyleClass(tBook, "listHighlighted");
trace ("Class Change");
}
else
{
TextUtilities.changeStyleClass (tBook, "list");
trace ("no class change");
}
}
Listener And OnChanged Timing For TextFields. Not For Faint-hearted Coders.
Hi,
Attached is something that works, but has a horrible kludge.
I am working on some textField components that resize dynamically when changed. Yes, I know there is an easier way. This seemed more elegant and it would have been if only ...
The challenge
To call functions to move items around in response to any change to the text or htmlText values in a field.
A solution
Call the function with the onChanged event.
The problem part 1
The onChanged event only fires for TF.type = "input", it doesn't fire at all for TF.type = "dynamic".
The solution part 1
Use a listener to catch the changes and fire the onChanged function.
The real problem part 2
The listener has to return the value for the property in order to work. Therefore, it calls the onChanged function before the value changes. This means, that resizing the textfield always lags behind. (Eg: For resizing to add a new line, the textfield resizes on the second change after the new line.).
The kludge solution part 2
I have used a setInterval to reschedule and make onChanged fire after the change occurs. This is kludge. There has to be a better way.
Strille? GSolo_01? Anyone?
Thanks,
Gaius
|