Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Xml Update Function Help Needed


Hello everybody,

I am new at this site and I am from the Netherlands so if I don't speak your language very well, excuse me for that.

Now I have a problem that I can't fix. So I'll explain it to you.

I have this kind of xml update function so that an xml file is automatically updated at a website instead of the user have to push the refresh button.

This part works fine and the xml really gets up te date everytime the animation is het number 1.

Another story is the animation itself. After a while playing the entire animation, it will "forgets" the order of the xml file and it will play soms of the items for the half and some don't show at all.

Can you please help me cause I have done everything I can do. Here is my actionscript code:


Code:
//speed is de snelheid van de beweging; Hoe kleiner hoe sneller.
var speed = 4;
//
var xmlFile = "http://www.informatiescherm.com/SWF/test.xml";
var xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(xmlFile+"?"+new Date().getTime());
//
resetXML = function(xmlData){
var xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(xmlFile+"?"+new Date().getTime());
}
//
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
caption = [];
url = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
caption[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
url[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
}
first_item();
} else {
content = "XML Bestand niet geladen!";
}
}
//
function first_item() {
delay = 3000; // Tijd voordat een nieuwe regel wordt geladen.
p = 0;
display(p);
p++;
}
function timer() {
myInterval = setInterval(ticker, delay);
function ticker() {
clearInterval(myInterval);
if (p == total) {
p = 0;
resetXML(xmlData);
}
verkleinen();
}
}
function display(pos) {
over = new TextFormat(); //Effecten voor mouse-over
over.underline = true;
//
out = new TextFormat(); // Effecten voor mouse-out
out.underline = false;
//
newsMC.newsText.text = caption[pos];
newsMC.onRelease = function() {
getURL(url[pos], "_blank");
};
newsMC.onRollOver = function() {
this.newsText.setTextFormat(over);
};
newsMC.onRollOut = function() {
this.newsText.setTextFormat(out);
};
timer();
}
function verkleinen() {
this.onEnterFrame = function() {
if(newsMC._height <= 22 and newsMC._height > 0){
newsMC._yscale += (0 - newsMC._yscale) / speed
}
else if(newsMC._height == 0){
vergroten();
display(p);
p++;
}
};
}
function vergroten() {
this.onEnterFrame = function() {
newsMC._yscale += (100 - newsMC._yscale) / speed
};
}




KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 09-18-2008, 05:11 AM


View Complete Forum Thread with Replies

Sponsored Links:

Been Asked To Update Payer When Not Needed
Hi,

I have not had MX long, and have been working along time with flash 5 so this a little new to me and I’m not sure if it is normal.

I have exported a few movies to sit in a page on a website. The must be flash player 5 compatible. So I exported them as flash player 5 (using flash mx) as they do not require any of the features of 6.

When a few people look at the page though, even though they have player 5, are prompted to update there player to version 6. Is this right, do movies exported from MX ask people to update to the latest version regardless if the movie needs it to run? It’s hard for me to do testing because I’m running player 6.

I defiantly exported them as player 5, and I have opened them in player 5 standalone just to be sure that player 5 reads them. I cannot work out when people are been asked to update when they already have flash 5 player?

Thanks in advance

View Replies !    View Related
HELP MX Test Movie Update Needed..
hi

sorry to post this here.. but its desperate..

ive been searching all day now.. i need to update my
test movie player in flash MX (6) not 2004...

i can find loads of 2004 updaters but no MX updaters..
i need to get r40 or over as im having problems
with the .sound function..

any help you guys could give me would be great..

View Replies !    View Related
Function Update?
Hey guys,
i have a question about this function that I made. It simulates movement. The way I have it set up is as follows:
function move(movie, location) {

movie._x=movie._x+(location._x-movie._x)/10;
movie._y=movie._y+(location._y-movie._y)/10;


}


is it possible, to get those two commands within the function to run over and over again until the movie reaches the location. I tried messing with some while statements but to no avail. Any help would be very much appreciate.d Thanks everyone
Don

View Replies !    View Related
Update Of Display While Function Is Running
I have a function where I run the following code:


ActionScript Code:
// Update database
    admin_status.text = "Here we go - lets get started with "+  arr_sql.length +" queries!";
    var db = new database();
    for (var i = 0; i < arr_sql.length; i++) {
        db.query(arr_sql[i]);
trace(i +"/"+ arr_sql.length +" completed...");
        admin_status.text = i +"/"+ arr_sql.length +" completed...";
        if (i >= 200) {
            break;
        }
    }
    admin_status.text = "Database updated.";

It runs many SQL queries and then for each query I want to update a TextField that I have named admin_status. So I set the text property for each loop but the only thing I ever see is "Database updated" when it's all done (but I see the traces). Why is that? Is the display only updated after a function has finished?

I guess I have to make asynchronous database queries instead?

Allan

View Replies !    View Related
Update Variable Names In A Function
I have a button that will call a function, nextProjImage()
In that function I have these 2 lines:
Pic1Desc_txt.htmlText = Pic1Desc[p];
detailimage1.loadMovie(picture1[p], 1);

When the button is clicked, I need to update Pic1Desc_txt.htmlText =
Pic1Desc[p]; to Pic1Desc_txt.htmlText = Pic2Desc[p]; and
update detailimage1.loadMovie(picture1[p], 1); to
detailimage1.loadMovie(picture2[p], 1);
Each time the button is clicked it needs to update the text and the pic by 1
until it reaches 6. After we have Pic6Desc[p] and (picture6[p], 1)
then upon another click of the button we go to Pic1Desc[p] and (picture1[p],
1) as a loop.

Help is much appreciated.

View Replies !    View Related
Event Function With Update Problems
I'm new to AS3 and are trying to make an external preloader. The Preloader class gets called by my "Main" class that is connected to my movie by "Document class". The function "Preloader" takes an URL as an argument and creates a status bar. The problem is that the x position in the event function "showProgress" doesn't update after the first event trigger. Everything works fine on the first event, but after that the x position doesn't update. My trace updates correctly during the preloading. I'm guessing that the call to the movieclip in the library that has linkage "myBar" and contains a mask with linkage "mask109" somehow is not found after the first event fired? There is no compile errors.

Any comments on what I should check or do to get on with my life







Attach Code

package [removed for forum display]
{
import flash.display.MovieClip;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.text.TextField;

public class Preloader extends MovieClip
{

private var myLoader:Loader = new Loader();
var myBar:PreloaderBar_mc = new PreloaderBar_mc;

public function Preloader(myURL:String)
{

var myRequest:URLRequest = new URLRequest(myURL);

myLoader.contentLoaderInfo.addEventListener(Event.OPEN,showPreloader);
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress);
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,showLoadResult);

myLoader.load(myRequest);
}

function loadFile(fileURL:String)
{
var myRequest:URLRequest = new URLRequest();

myLoader.contentLoaderInfo.addEventListener(Event.OPEN,showPreloader);
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress);
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,showLoadResult);

myLoader.load(myRequest);
}

function showPreloader(e:Event):void
{
myBar.x = 50;
myBar.y = 50;
addChild(myBar);
}

function showProgress(e:ProgressEvent):void
{
var percentLoaded:Number = e.bytesLoaded / e.bytesTotal;
percentLoaded = Math.round(percentLoaded * 100);
if (percentLoaded > 0) {
myBar.mask109.x = percentLoaded - 100;
trace(percentLoaded);
}
}

function showLoadResult(e:Event):void
{
trace("Load complete");
addChild(myLoader);
}

}

}

View Replies !    View Related
Client Update Function In Flash?
Hey, im making a portfolio for a photographer. I need a way that my client can easily upload jpg images. Is there a way to have a adminlogin on the homepage, and from there be able to upload photos?

View Replies !    View Related
Update (refresh) Screen During Loop In A Function
Hi all,

I tried to figure this one out myself, but I need your help finally.

I am using some functions that need fairly long when used with long texts. (See example below)

To give the user some pseudo-feedback meanwhile (instead of a frozen screen only), I tried to show a small spinning object while the function is performing.

But, setting the _rotation property of my movie "spin" within the while-loop won't work, because the screen is being refreshed apparently once a frame only.

On the other hand I don't want to leave the function and continue the work in the next frame, just to spin my work-indicator in the meantime. This would slow down execution significantly.

What workaround can you suggest to have the "spin"-movie spinning?

Here is my example-function -


Code:

function str_replace (matchstr, replacestr, str) {

ml = matchstr.length;
sslice = str;
newstr = "";

while ((lastmatch=sslice.indexOf(matchstr))>-1)
{
newstr += (sslice.slice(0, lastmatch) add replacestr);
sslice = sslice.slice(lastmatch+ml);
_root.spin._rotation += 15;
}

return (newstr += sslice);
}



Regards,
Miran

View Replies !    View Related
Update Text Field From Javascript Function?
Is this even possible? Can I get flash to check and update a text field that is set to a variable in a javascript function on my html page? When the variable in the javascript updates I'd like the text field in my flash movie to update as well. Perhaps I could bodge it and use some form of setinterval to just check the javascript variable every second or so?

All I need is a shove in the right direction!

Many thanks,
jbw

View Replies !    View Related
Update A Textfield From A Function Inside An As File
I'm trying to update a text field on my stage based on the results of a function. My function is in a as file however when it gets to the

textField.text="something" part it errors out with the following message
ReferenceError: Error #1065: Variable mainDisplay is not defined.

here is the line in my functin code
mainDisplay.text="GAME OVER TRY AGAIN";

how do i reference the textField mainDisplay from the function contained with the as file

I have tried stage.mainDisplay

any help would be appreciated.

regards

View Replies !    View Related
Newbie: Getting Display To Update From SetInterval Function Callback. (First Post)
Hi All,

Please forgive me. I am completely new to this stuff, and I am going to post several questions over the next week or so. Unfortunately, I am trying to do some things in areas of several new technologies for me. I am new to Windows, C#, .Net, Flash, and ActionScript, and the project that the company I work for has me working on right now uses all of those technologies.

I will try to break my questions into small chunks so that they are as simple as I think I can make them in order to post the questions. I thank you for your tolerance, and assistance.

In the example below I have one frame and some actionscript on an actions layer located on frame 1. I have a couple of dynamic text fields with different instance names, and I am trying to write text into those fields.


(Code for buttons not included, since I don't believe they will make any difference in helping. If you need them, please let me know).
I have two buttons and handlers for them that when called, increment a number and that number is then inserted into one of the dynamic text fields. That seems to work, and the value increases and decreases as necessary.

The problem comes in the setInterval callback. I created a function that increments a counter, and takes the value of that counter and places it into the other dynamic text field. That function is then installed into a setInterval call. However, the textfield never seems to update to the new values. I even included a call to something I read would force the display to update from setInterval calls, but that doesn't work either.

I would appreciate any assistance I can get. I have several of these kinds of problems that I believe are probably easy for someone else to answer, but I don't know the answers to. I look forward to my experiences on this board, and if there is anything I can answer for others, please know I will. Please find my code listed just below.

Just as an FYI, I am including the FlashPlayer control on a panel inside a C# program which I am creating with Visual Studio .Net. I am communicating between ActionScript and C# .Net using the ExternalInterface API. I don't have that working well yet, but a simple single function is working. This will be important information when I eventually post my other questions.



Code:
import flash.external.ExternalInterface;

// See if the Container even offers an External Interface.
var bIsExternalInterfaceAvail=ExternalInterface.available;
// Register all the externally available functions
var bIsRegSetBetVal:Boolean=ExternalInterface.addCallback( "SetBetVal", this, SetBetVal );
var bIsRegDisplayScrnStartup:Boolean=ExternalInterface.addCallback( "DisplayScrnStartup", this, DisplayScrnStartup );

var iIntervalCnt01:Number=( 0 );


trace("We Entered Our Movie.");
trace("Start SetInterval Function.");
setInterval( DisplayScrnStartup, 5000 );
trace("Finished SetInterval Function.");
trace("Start Call to RequestInitialBetAmount Function.");

// Kept out for now since debugger seems to not work
// after the call.
//ExternalInterface.call( "RequestInitialBetAmount" );

trace("Finished Call to RequestInitialBetAmount Function.");
Mouse.hide(); // Hides the Mouse from the Screen. (We are using TouchScreen).
stop(); // I understand this to mean playhead stops, not Actionscript code.
trace("Finished Frame 1.");


// Sets the Text in a Dynamic Field to be a Value.
// This function works, and the screen display is updated.
function SetBetVal( a_CurBetVal:Number ):Void
{
trace("Setting the Bet Value to " + a_CurBetVal + " value." );
this.sampleField.text=( a_CurBetVal.toString() );
}


// This function tells the system to display the StartUp Screen.
// For now this function just tries to update another dynamic text
// box on screen. Though this doesn't work.
function DisplayScrnStartup()
{
trace("Inside DisplayScrnStartup.");
//this.gotoAndStop( "Scrn_Startup" );
this.iIntervalCnt01=( this.iIntervalCnt01 + 1 );
var szIntervalCnt:String=this.iIntervalCnt01.toString();
this.SetIntervalCnt01.text=( szIntervalCnt );

/*
I even tried updating the other Dynamic Text field that was
working and being updated just to see if that one would update
and this one wouldn't. However, now both wouldn't update.
*/
//this.sampleField.text=( szIntervalCnt );

// Tell the system to update the display since this function
// inside a setInterval callback, updated display items.
updateAfterEvent();
}




Also, in the future, would it be easier or better or both for me to simply attach a .zip file with the code file?

Thanks.

View Replies !    View Related
Dynamic Text Field Won't Show Update Until NEXT Update Happens
Hi,

In a very simple Flash file with bascially just a dynamic text field and a button I attached some very simple code to the button that updates the text fields .text parameter, like this:

on(click) {
some_textfield.text = some_value;
}

With trace(...) I have verified that "some_value" is what I want it to be. However, the txt field doe NOT get updated! It gets that (b ythen old) value the NEXT time I press the button!

So when I start the flash movie and click the button nothing happens, the next time I see the value I should have seen the first time, etc. - always one event late. Since the trace() I put inside the on(click) handler shows the correct value I'm really at a loss to explain why the text field is not updated.

Any explanations?

PS: By the way, I'm using font "_sans" so there's no font to embed, but trying Arial with "embed numbers" (I want to display an integer number) doesn't work either. I only mention that because I think to have observed something like the above strange behavior caused by embedding (or not) the characters.





























Edited: 09/04/2007 at 09:23:57 AM by Hasenstein

View Replies !    View Related
Function Help Needed
Can you use a variable to target a property of a movie clip? What I wish to do is have my functions on the main timeline, and when I invoke my functions I will supply parameters. These parameters will tell the function how to find the _y property for instance. I.e. (_root.newsDisplay.scrollBar._y). What would be the best is if I can make the newDisplay instance name a variable as well. That way everything that I need scrolled will use the one function and I can supply the instance name as a parameter of the function.

Thanks in advance.

View Replies !    View Related
Function Help Needed
onClipEvent (load) {
function angle(){
(n+1)*90;
n=a;
a=0;
}

onClipEvent (enterFrame) {
if (Key.isDown(Key.DOWN)) {
a=1;
this._rotation=angle();
}
}

Doesent want to work. I am just trying to play around with functions.
I need the characters _rotation=180 when i press DOWN. I dont want any other version of making the thing rotate, i need this working!
Great thanks for the help!!!

Using flash 5

View Replies !    View Related
[F8] Function Help Needed
Ive been working on something And hit a snag How could I call a function from inside a frame inside a movieclip?

Any help is appreciated

View Replies !    View Related
Function Help Needed
I have a function in the first frame of my main timeline. This is the function.

function DropArea() {
if (_root.Level == 1) {
_x = (Math.floor(Math.random()*20)+13)*10;
_y = (Math.floor(Math.random()*15)+18)*10;
}
}

I am calling the function from a movie clip on the main timeline but for some reason it is moving the whole flash movie's x,y cords, not the movie clip that is calling the function.

How do I make my function move the movie clip that calls it instead of the location the function resides?

View Replies !    View Related
Player 9 Update-Firefox Update And Bandwidth
Hi,

I have a site of mine online which I created some 2.5 years ago probably with Flash MX--Recently, my hosting company informed me that I had allotted my bandwidth allowance--I had recently installed the latest version of the Flash Player as well as the latest version of Mozilla Firefox--It seems that through viewing my site in the updated Firefox browser with the updated player there was some code in my swf which apparently kept trying to download the mp3 file --Some 271769 hits in a few hours resulting in using 1341.07 GB of bandwidth, all originating from IP address, btw--The hosting company is threatening to charge me at the rate of $10 per 5GB over my allotted bandwidth-I get 20GB free per month--That means they are planning to charge me over $2,600 --
Anyway, here is the code:

Code:
jimi = new Sound();
jimi.loadSound("jimi.mp3", true);
jimi.onSoundComplete = function() {
jimi.loadSound("jimi.mp3", true);
};
Which has not caused any problems in over 2 years and countless viewings until the recent installations of the most current security updates to the Flash 9 Player and Firefox-

Does anyone know if the code is now incompatible with the new player and/or firefox and if there is a way to fix this without redoing the entire site in AS3?

Thanks
---Yvette

View Replies !    View Related
Help Needed W/ Javascript Function
I am doing this using javascript inside an html doc., but I thought someone here may be able to help me. Thank you.

I am trying to calculate the square feet of carpet that is required to carpet a room. I have one text box for the width, another for the length, and another for the cost per square feet. The names of the these text boxes are width, length, and cost. When I click on the button to calculate the cost I want it to add 25% to the total number of square feet to account for closests etc, and display this info. in an alert box. Here it was I have so far. I need some help with how to figure out this calculation and the syntax that would make up this function...

function calsqft () {
var carpet = (document.calculate.width.length.cost.value);
alert("The total cost for the carpet is " + carpet + "");
}

Then I call the funtion on the submit button...

value="Submit" onClick="calsqft();"

Thank you for your help
jhb

View Replies !    View Related
More Help Needed With An Array/for Function
Right...

for (i=0; i<posts; i++) {
duplicateMovieClip(_root.sectionholder.newssystem. newscon, "newscon"+i, i);
setProperty("newscon"+i, _x, 0);
setProperty("newscon"+i, _y, i*20);
newscon[i].title = title[i]+" - POSTED BY"+postedby[i];
newscon[i].date = "aa";
newscon[i].post = post0;
}

This is the code in question. The problem is the '[i]'. I need it to set variables in newscon0, newscon1, etc, but the [i] thing doesn't do it.

What will? Thanks in advance

View Replies !    View Related
Help Recursive Xml Function Needed
Hi there, can anyone help in building in a recursive function that will go through all the nodes in my xml file looking for a particular attribute?

thanks

frank

View Replies !    View Related
Language Function Help Needed
Hello,

I am very new to Flash MX actionscripts. What I'm trying to create is a function that can switch between two languages (english and swedish) without any delays and glitches.

What I need is a button that says "Svenska" that when pressed changes different movieclips throughout the scene to swedish as well as itself to "English" as to be able to change back to english.

When the language button is pressed, all of the movieclips displayed at that given moment should be switched instantly to the correct language (i.e. in a movieclip there is a switch taking place between the movieclips welcome_en and welcome_sv).

Also, the scene should be able to remember what language that is the active one so that when a new language specific movieclip enters the stage the correct language is displayed.

I've tried a couple of different ways but can't get the codes to work or get really bad results. Please assist!

View Replies !    View Related
Multiple MC - One Function Help Needed
ok
i have mc. they are called Tile0_0 Tile0_1....Tile9_9
now i neet to attach to everyone of them a function which is called on mc press.

i did like this

for(i=0;i<10;i++){
for(j=0;j<10;j++){
_root.["Tile" + i + "_" + j].onPress = function():Void{
if(grid2[i][j] == 0)
trace("OK");
}
}
}

but this is wrong code. I does not work as i want it t0

help anyone?

View Replies !    View Related
Function Argumet Needed?
I've got this external as file on a folder called myClass:


Code:
package myClass{

import flash.display.MovieClip; //importo il costrutto che mi serve per usare l'embed font sullo stage
import flash.display.*; // importo i costrutti per la visualizzazione degli oggetti
import flash.events.*; // importo i costrutti per gli eventi
import flash.net.*; // importo i costrutti per l'xml
import flash.display.Sprite; // importo il costrutto per lo sprite
import flash.display.Shape;// importo il costrutto per disegnare forme
import flash.filters.DropShadowFilter;// importo il costrutto per il filtro ombra

public class Attachmovie extends MovieClip {

//--------------------------------------------------------------Constructor-----------------------
public function Attachmovie() {

var alt = 150;//dichiaro la variabile per settare l'altezza delle thumbs
var larg = 300;//dichiaro la variabile per settare la larghezza delle thumbs
var index:Number;//dichiaro la variabile indice per caricare le foto da xml

var filtro = new flash.filters.DropShadowFilter;//imposto la variabile filtro per l'effetto ombra
filtro.color = 0x3C3C3C;//imposto il colore dell'effetto ombra
filtro.distance = 5;//imposto la distanza dell'effetto ombra
//----------------------------------------------------------Create a Sprite object---------------
var s:MovieClip = new MovieClip();//imposto il contenitore totale sprite
s.x = 10;//imposto la coordinata x del contenitore
s.y = 10;//imposto la coordinata y del contenitore
addChild(s);//visualizzo il contenitore

//----------------------------------------------------------create loader object--------------------
var ldrLarg = 0;//setto la larghezza della foto centrale
var ldrLung = 0;//setto la lunghezza della foto centrale

//--- Funzione che richiama l'evento al caricamento della foto centrale per poter modificarne le dimensioni ---//
function completeHandler(event:Event):void {
event.currentTarget.width = ldrLarg;//imposto la larghezza della foto centrale da variabile
event.currentTarget.height = ldrLung;//imposto la lunghezza della foto centrale da variabile
}

var ldrContainer:MovieClip = new MovieClip();//creo una movie clip che contenga la foto centrale caricata
var ldr:Loader = new Loader();//creo il loader della foto centrale

addChild(ldr);//visualizzo il loader

firstimg(1);//e ne carico la prima immagine della lista

ldrContainer.addChild(ldr);//inserisco il loader dentro il suo contenitore

ldrContainer.x = s.x + larg + 100;//setto la coordinata x della foto centrale
ldrContainer.y = s.y;//setto la coordinata y della foto centrale
ldrContainer.filters = [filtro]; //imposto il filtro della foto centrale da variabile
s.addChild(ldrContainer);//metto il contenitore della foto centrale dentro il contenitore sprite totale



// ---------------------------------------------------------load an xml------------------------
//--------------------------------------------load XML-----------------

var xmlLoader:URLLoader = new URLLoader();//imposto una variabile che carichi un file esterno
var xmlData:XML;//creo una variabile che legga i dati XML
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);//creo il listener che iposti una funzio e al completamento del caricamento XML
xmlLoader.load(new URLRequest("gallery.xml"));//carico il file gallery.xml



//---Funzione collegata al listener di caricamento XML---//
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);//carico la foto nel thumbnail
}



//--------------------------------------------------------Creating a loop for multiple addChild--
var j = 0;//imposto la variabile j per distanziare i thumbs
for (var i=1; i<5; i++) {//mando un altra variabile i da 1 al numero massimo di item nel file xml
var newLdr:Loader = new Loader();//creo un loader per i thumbs
var new_Mc: MovieClip = new MovieClip();//creo un contenitore per il loader di thumbs
var thumb:URLRequest = new URLRequest("images/pic_"+i+".jpg");//imposto la richiesta di caricamento dei file esterni

//---//creo una maschera per definire i thumbs---//
var thumbMask: MovieClip = new MovieClip();

var forma:Shape = new Shape();
forma.graphics.beginFill(0x000000);
forma.graphics.drawRect(0, 0, larg, alt);
forma.graphics.endFill();
//--------------------------------------------//

thumbMask.x = 10;//imposto la coordinata x della maschera dei thumbs
thumbMask.y = j + (i*5);//imposto la coordinata y della maschera dei thumbs

j = j + alt; // definisco la distanza della prossima thumb

thumbMask.addChild(forma);//inserisco la forma dentro la MC maschera

newLdr.load(thumb);//carico la thumb esterna
newLdr.scaleX = 0.8;//scalo la thumb sull'asse X
newLdr.scaleY = 0.8;//scalo la thumb sull'asse Y
new_Mc.addChild(newLdr);//metto il caricatore di thumb dentro la movie clip

s.addChild(new_Mc);//metto la movie clip delle thumbs dinamiche dentro il visualizzatore sprite totale

new_Mc.y = thumbMask.y/2;//centro le thumbs in base alla maschera sull'asse Y
new_Mc.x = thumbMask.x/2;//centro le thumbs in base alla maschera sull'asse X
new_Mc.buttonMode = true;//rendo le thumbs simili ad un bottone

new_Mc.mask = thumbMask;//maschero le thumbs

new_Mc.I_value=i;//collego il mc delle thumbs dinamiche al valore della i
new_Mc.addEventListener(MouseEvent.CLICK, clickHandler); //setto il listener delle mc delle thumbs dinamiche all'evento click del mouse

new_Mc.filters = [filtro];//aggiungo il filtro ombra al mc delle thumbs
}

//---Funzione collegata al click del mouse delle thumbs---//
function clickHandler(e:MouseEvent):void {
index= e.currentTarget.I_value;//la funzione prede come target la thumb cliccata
var urlReq:URLRequest = new URLRequest("images/pic_"+index+".jpg");//carico nella foto centrale l'immagine della thumb
ldr.load(urlReq); //imposto il loader della foto centrale

if(e.currentTarget.width>e.currentTarget.height){//se la larghezza della thumb cliccata è maggiore della sua lunghezza
ldrLarg = 500;//setto la larghezza della foto centrale
ldrLung = 250;//setto la lunghezza della foto centrale
ldrContainer.addEventListener(Event.ADDED, completeHandler); //richiamo la funzione che setta le dimensioni della foto centrale
}
else{//altrimenti
ldrLarg = 300;//setto la larghezza della foto centrale
ldrLung = 350;//setto la lunghezza della foto centrale
ldrContainer.addEventListener(Event.ADDED, completeHandler);//richiamo la funzione che setta le dimensioni della foto centrale
}


}

//---Funzione che carica la foto della prima thumb sulla foto centrale---//
function firstimg(index) {
var urlReq_first:URLRequest = new URLRequest("images/pic_"+index+".jpg"); //carico l'immagine estera
ldr.load(urlReq_first);//e la visualizzo sulla foto centrale
ldrContainer.addEventListener(Event.ADDED, completeHandler);//richiamo la funzione che setta le dimensioni della foto centrale
ldrLarg = 500;//setto la larghezza della foto centrale
ldrLung = 250;//setto la lunghezza della foto centrale
}


}
}
}
On the flash file I write this:


Code:
import myClass.Attachmovie;

Attachmovie();
But it asks me to write an argument...I don't pass any one of them...what can I do??

View Replies !    View Related
_global. Function Help Needed
Hi Everyone,

CS3/AS2

I am attempting to use the TextMetrics class in a _global. function, but I'm unsure as to the relationship between the function and the mc layer calling it. If you could take a quick peek at my code it would be greatly appreciated.


A side note: if you have time...... i believe that there will be a conflict if this function is called multiple times from the same mc, any heads up on preventing this would be awesome.

The Class used can be found here: http://blog.greensock.com/textmetrics/

My test Movie: http://drop.io/textmetrics


Thanks everyone,

Martha

View Replies !    View Related
GotoAndPlay Function.....help Needed
Hi,

I am trying to make a televison that when a combination of numbers are pressed, and enter is pushed, it will go to a specific scene depending on what numbers were pushed.

Here is the script i have so far

Code:
Button_Enter.onPress = function()
{
scene = "Website_" + channel.text;
gotoAndPlay("scene", 0);



}
That is the script for the Enter button.

Website_ is the name of the scene + channel.text which is the number

For example, when i punch in 8 and press enter, it takes me to the next slide which is Website_1, insead of Website_8.

Any help would be greatly apreciated.

View Replies !    View Related
Help Needed With Time Function
Hi, I'm trying to make a clock that shows different times for different countries. here is the code for the clock but how do I make it show the time x hours forward or back?

onClipEvent (enterFrame) {
time = new Date();
mil = time.getMilliseconds();
s = time.getSeconds();
m = time.getMinutes();
h = time.getHours();
seconds._rotation = s*6+(mil/(1000/6));
minutes._rotation = m*6+(s/10);
hours._rotation = h*30+(m/2);
}

cheers

View Replies !    View Related
_global. Function Help Needed
Hi Everyone,

CS3/AS2

I am attempting to use the TextMetrics class in a _global. function, but I'm unsure as to the relationship between the function and the mc layer calling it. If you could take a quick peek at my code it would be greatly appreciated.


A side note: if you have time...... i believe that there will be a conflict if this function is called multiple times from the same mc, any heads up on preventing this would be awesome.

The Class used can be found here: http://blog.greensock.com/textmetrics/

My test Movie: http://drop.io/textmetrics


Thanks everyone,

Martha

View Replies !    View Related
Function And Actionscript Buttons Help Needed
ok hey guys...I am having a problem with these actionscript buttons that are using function()

I have two movies... shell.swf which is my timeline. on the first frame i am loading another swf named framework.swf into _level100. the buttons i want to control the main timeline are inside the framework.swf in a mc called frame they are named next_btn and prev_btn

I have this code on the 25th frame of the shell.swf...

// _level 100 next/prev button script
_level100.frame.next_btn.onPress = function(){
this.gotoAndPlay("section_2_slide_1");
}


thanks for any help you an give me

Mike

View Replies !    View Related
Help Needed With Math.round Function....
Hi,

I have this piece of code :

var c4 = Math.sqrt ((c3*(1-c3)/(num1+num2))+(c3*(1-c3)/(num3+num4)));
When I run my program I get values upto several decimals. How do I use the Math.round to the above piece of code to truncate to say 4 decimal places.

Please suggest.

Thanks.

View Replies !    View Related
Help Needed - Simple XML Function..[Flash8]
Hi

I’ve been wondering for a while now why this function I have created won’t work.
Any help would be much appreciated

I’m loading text from an XML file into a dynamic text-box in my swf.

I then created a function:

_gloabal.signalCheck = function(){

if (mysignal == "1") {
//mysignal is a dynamic text-box where “1” is loaded from XML
gotoAndPlay("win");
}
}

and added this function to a button on the same frame:

on (release){
signalCheck();
}

The XML works fine, as the number “1” is displayed inside in the swf. However, the function doesn’t see “mysignal” as a typical dynamic text-box as it does not respond to it.

Could anybody tell me a work-around for this, or a method that responds to the actual text sent from XML.

Much obliged…

View Replies !    View Related
If Function To Fade A Level In Or Out As Needed.
On my stage i have buttons.swf(9 buttons) loaded into level 4.

I also have an animation.swf playing in level 7.

When I press some of the buttons I need the animation.swf to slowly fade away and stop playing if it is already playing.

When I press some of the buttons I need the animation.swf to fade in and start playing if it isn't already playing or continue playing if it already playing.

It all depends on which buttons are pressed and the order they are pressed as to whether the animation is already playing and whether the animation is told to fade away and stop or told to reappear and continue playing. ie. some button options require the animation to stay or reappear and some require it to go away.

I need to use a Function and If commands.

Any idea how you would script this please?

would you use something like - if level7._alpha>0 then _level7.gotoAndPlay(fadeout) and if _level7._alpha<1 then loadMovie animation.swf into level7.

Just need an efficient way that you would script this. I think I can work out the actual syntax - if you could just point me to the most logical way please.

Thanks for the advice.

View Replies !    View Related
HELP NEEDED With Query And Array Search Function
Hi,
im havin trouble when im searching for a value from an array (all of it). The array is determined by a query string which follows:

order.swf&LOCT0=bedroom&LOCT1=dwelling&LOCT2=kitch en&LOCT3=landing


Below is the script i am using. It works but it only searches the first array instead of the whole set?? what is wrong with it??


PHP Code:



Location = new Array();
for (i=0; i<numLocs; i++) {
    Location[i] = eval("LOCT"+i);
}

for (i=0; i<numLocs.length; i++) {
    if (Location[i] == "bedroom") {
        _root.mc_list.bedroom._visible = true;
    } else {
        _root.mc_list.bedroom._visible = false;
    }
}




Please help!

thanks,
Shahid

View Replies !    View Related
Trig. Function Needed, Not In Math Object
Calling all math club wizards, your help would be much much appreciated.
The Math object doesn't have a "secant", and I'm not math savvy enough to find its equivilant formula, nor have I found one in an exaustive tutorial search.

The problem I have I can't find anywhere online.
I need flash to trace an angle in a right triangle when only the hypotenuse and adjacent sides are known, translated into nice and neat actionscript.
(The pen and paper version is sec(Angle) = hypotenuse/adjacent. I need to solve for "Angle"). Any takers? Much much thanks.

View Replies !    View Related
Help On OnClipEvent() Autoplay Function Or New Code Needed
problem solved - http://www.flash8components.com

View Replies !    View Related
FLV Player Script - Clear Function Needed
Aloha everyone, I am working on a film company website, experiencing some issues with the flv player. I am urgently seeking some help on creating the "clear function" to initialize the process, could anyone help me what please? Thanks in advanced. Karo

View Replies !    View Related
Switching Levels Of Swf:s Or Similar Function Needed
Hey guys,

I'm putting together a quite large site for school based in Zanzibar and, obviously, they want to show of the beauty of the country with
a large selection of images, used as backgrounds for the more than 20 seperate pages on the site.
To make it as smooth as possible to navigate through the site, I've put every single background in a separate SWF and I've made them load in a low level only when needed. This works smoothly, except for one, pretty big, problem.
The structure is basically this as of now:
I have a first SWF in _level0 which loads the first background SWF in _level1 on Frame1 and it also loads the menu in _level200.
In the menu, the second button loads the second background in _level2 and so far everything works fine, but as you might have figured out, this is not a solution that will hold up, since I can't just go on loading the rest of the 20 backgrounds on top of each other.

So my question is this:
is it some how possible to switch the levels of an active swf, i.e. on load completion move the second background SWF from _level2 down to _level1 (and of course unload the first SWF)?

It might be obvious to maybe everyone except me, that this is not possible, and if that is the case, I'd be very grateful for any suggestions on how to solve the issue of 20+ heavy background images on one site.

Best regards!

/Carl-Johan

View Replies !    View Related
Switching Levels Of Swf:s Or Similar Function Needed
Hey again guys,

I posted this thread under actionscript but with no luck so maybe one of guys can help me out.
@ Admins: I hope its alright to post the thread again, otherwise feel free to delete either one, which ever you think is better.

I'm putting together a quite large site for school based in Zanzibar and, obviously, they want to show of the beauty of the country with
a large selection of images, used as backgrounds for the more than 20 seperate pages on the site.
To make it as smooth as possible to navigate through the site, I've put every single background in a separate SWF and I've made them load in a low level only when needed. This works smoothly, except for one, pretty big, problem.
The structure is basically this as of now:
I have a first SWF in _level0 which loads the first background SWF in _level1 on Frame1 and it also loads the menu in _level200.
In the menu, the second button loads the second background in _level2 and so far everything works fine, but as you might have figured out, this is not a solution that will hold up, since I can't just go on loading the rest of the 20 backgrounds on top of each other.

So my question is this:
is it some how possible to switch the levels of an active swf, i.e. on load completion move the second background SWF from _level2 down to _level1 (and of course unload the first SWF)?

It might be obvious to maybe everyone except me, that this is not possible, and if that is the case, I'd be very grateful for any suggestions on how to solve the issue of 20+ heavy background images on one site.

Best regards!

/Carl-Johan

View Replies !    View Related
Function Doesn't Work According To Path - Help Needed
ok, I've been fighting this since yesterday with no results and by now I'm going a bit desperate... if anyone out there knows of any info on this available through the web or have dealt with and cracked a similar problem, please, please, please, I could desperately use some advice.

I've searched for related issues, but none of them seems to cover this and I guess that's partly because, for absurd as it might sound, there's nothing wrong... let me make it clearer:

I'm programming a dinamic flash/xml website. up until now I've kept the info for the menus and the one for the gallery (the site has a gallery that displays both text and images) in separate xml files. but I'm trying to make all of it work out of a single xml file. I've managed to make the menus and the gallery all go get the info correctly to the xml (text and images), but then I came up with a problem that jeopardizes the whole show: a path inside the xml's onLoad function refuses to work! the code that bears the function has to be placed into the same clip as the clips that contain the text fields to wich info will be passed or it won't do a thing.

supose this is my actionscript code:


Code:
var contentSubMenu = new XML();
contentSubMenu.ignoreWhite = true;
contentSubMenu.load("example.xml");

//--------------------------------------------------

_root.contentSubMenu.onLoad = function() {

/* code */

//path to where the clips that bear the text fields to be filled are contained
var buttonList = _root.listSubMenu_mc.listWindow_mc.buttonListSlide_mc;


//example of buttonList usage:
//1) category loop
for (a=0; a<categories.length; a++) {
var category = categories[a];

//duplicates the clip that contains the category text field, assigns the proper category to that text field and adjusts the clips y position
buttonList.category_mc.duplicateMovieClip("category"+a+"_mc", getNextHighestDepth());
buttonList["category"+a+"_mc"].category_txt.text = category.toLowerCase();
...
...

/* loads of code */

}
unless _root.contentSubMenu.onLoad = function() and the code from there on is placed into _root.listSubMenu_mc.listWindow_mc.buttonListSlide _mc (right above category_mc),
no information is passed to that clip. If the path targets that clip one should expect it to, right? even if all this code is placed on _root, right? well, it doesn't happen...
I tried tracing for info that comes from the xml, but nothing is displayed in the output window.

I've attached a zip file that contains a fla file, an xml file, a txt file with the full chunk of actionscript code and the fonts you'll be needing should you decide to take a look (they're only two).

The fla file has been built in the following manner:
_on the right side, the clips that hold the text fields to wich the contentSubMenu.onLoad function will pass info to are directly placed upon _root (so, following the code example from above, it would be like having var buttonList = _root;)
_on the left side, the clips that hold the text fields are down into buttonListSlide_mc and the contentSubMenu.onLoad function is there as well, only commented so it doesn't display anything.

that way one situation is compared with the other more easily.

I have no idea why this is and if it should work it would make my code and website a lot more cleaner and effective, so if anyone would like to help I'd be deeply thankful.

View Replies !    View Related
Function Doesn't Work According To Path - Help Needed
ok, I've been fighting this since yesterday with no results and by now I'm going a bit desperate... if anyone out there knows of any info on this available through the web or have dealt with and cracked a similar problem, please, please, please, I could desperately use some advice.

I've searched for related issues, but none of them seems to cover this and I guess that's partly because, for absurd as it might sound, there's nothing wrong... let me make it clearer:

I'm programming a dinamic flash/xml website. up until now I've kept the info for the menus and the one for the gallery (the site has a gallery that displays both text and images) in separate xml files. but I'm trying to make all of it work out of a single xml file. I've managed to make the menus and the gallery all go get the info correctly to the xml (text and images), but then I came up with a problem that jeopardizes the whole show: a path inside the xml's onLoad function refuses to work! the code that bears the function has to be placed into the same clip as the clips that contain the text fields to wich info will be passed or it won't do a thing.

supose this is my actionscript code:


Code:
var contentSubMenu = new XML();
contentSubMenu.ignoreWhite = true;
contentSubMenu.load("example.xml");

//--------------------------------------------------

_root.contentSubMenu.onLoad = function() {

/* code */

//path to where the clips that bear the text fields to be filled are contained
var buttonList = _root.listSubMenu_mc.listWindow_mc.buttonListSlide_mc;

//example of buttonList usage:
//1) category loop
for (a=0; a<categories.length; a++) {
var category = categories[a];

//duplicates the clip that contains the category text field, assigns the proper category to that text field and adjusts the clips y position
buttonList.category_mc.duplicateMovieClip("category"+a+"_mc", getNextHighestDepth());
buttonList["category"+a+"_mc"].category_txt.text = category.toLowerCase();
...
...

/* loads of code */

}
unless _root.contentSubMenu.onLoad = function() and the code from there on is placed into _root.listSubMenu_mc.listWindow_mc.buttonListSlide _mc (right above category_mc),
no information is passed to that clip. If the path targets that clip one should expect it to, right? even if all this code is placed on _root, right? well, it doesn't happen...
I tried tracing for info that comes from the xml, but nothing is displayed in the output window.

I've attached a zip file that contains a fla file, an xml file, a txt file with the full chunk of actionscript code and the fonts you'll be needing should you decide to take a look (they're only two).

The fla file has been built in the following manner:
_on the right side, the clips that hold the text fields to wich the contentSubMenu.onLoad function will pass info to are directly placed upon _root (so, following the code example from above, it would be like having var buttonList = _root;)
_on the left side, the clips that hold the text fields are down into buttonListSlide_mc and the contentSubMenu.onLoad function is there as well, only commented so it doesn't display anything.

that way one situation is compared with the other more easily.

I have no idea why this is and if it should work it would make my code and website a lot more cleaner and effective, so if anyone would like to help I'd be deeply thankful.

View Replies !    View Related
Function Doesn't Work According To Path - Help Needed
ok, I've been fighting this since yesterday with no results and by now I'm going a bit desperate... if anyone out there knows of any info on this available through the web or have dealt with and cracked a similar problem, please, please, please, I could desperately use some advice.

I've searched for related issues, but none of them seems to cover this and I guess that's partly because, for absurd as it might sound, there's nothing wrong... let me make it clearer:

I'm programming a dinamic flash/xml website. up until now I've kept the info for the menus and the one for the gallery (the site has a gallery that displays both text and images) in separate xml files. but I'm trying to make all of it work out of a single xml file. I've managed to make the menus and the gallery all go get the info correctly to the xml (text and images), but then I came up with a problem that jeopardizes the whole show: a path inside the xml's onLoad function refuses to work! the code that bears the function has to be placed into the same clip as the clips that contain the text fields to wich info will be passed or it won't do a thing.

supose this is my actionscript code:


Code:
var contentSubMenu = new XML();
contentSubMenu.ignoreWhite = true;
contentSubMenu.load("example.xml");

//--------------------------------------------------

_root.contentSubMenu.onLoad = function() {

/* code */

//path to where the clips that bear the text fields to be filled are contained
var buttonList = _root.listSubMenu_mc.listWindow_mc.buttonListSlide_mc;

//example of buttonList usage:
//1) category loop
for (a=0; a<categories.length; a++) {
var category = categories[a];

//duplicates the clip that contains the category text field, assigns the proper category to that text field and adjusts the clips y position
buttonList.category_mc.duplicateMovieClip("category"+a+"_mc", getNextHighestDepth());
buttonList["category"+a+"_mc"].category_txt.text = category.toLowerCase();
...
...

/* loads of code */

}
unless _root.contentSubMenu.onLoad = function() and the code from there on is placed into _root.listSubMenu_mc.listWindow_mc.buttonListSlide _mc (right above category_mc),
no information is passed to that clip. If the path targets that clip one should expect it to, right? even if all this code is placed on _root, right? well, it doesn't happen...
I tried tracing for info that comes from the xml, but nothing is displayed in the output window.

I've attached a zip file that contains a fla file, an xml file, a txt file with the full chunk of actionscript code and the fonts you'll be needing should you decide to take a look (they're only two).

The fla file has been built in the following manner:
_on the right side, the clips that hold the text fields to wich the [i]contentSubMenu.onLoad[i] function will pass info to are directly placed upon _root (so, following the code example from above, it would be like having var buttonList = _root;)
_on the left side, the clips that hold the text fields are down into buttonListSlide_mc and the contentSubMenu.onLoad function is there as well, only commented so it doesn't display anything.

that way one situation is compared with the other more easily.

I have no idea why this is and if it should work it would make my code and website a lot more cleaner and effective, so if anyone would like to help I'd be deeply thankful.















Attached Files

View Replies !    View Related
Timer Function Needed To Goto And Play Frame 1
Hi i need some sort of timer function, i am a newbie at flash, and would love some input.

I made a dynamix txt box which gets its data from an external source (http://radio.megamixers.net/flash.txt) i need that txt file reloaded every 60 seconds or so, so i can keep it showing whats played on the radio now.

Hope someone can help me out

My .FLA is here

http://www.codes.dk/titleupdater.fla


Hope to get some help - ive been all over the net looking for a function to handle this but no luck..

Kind regards
Cosmo

View Replies !    View Related
Help Needed: Buttons And StartDrag Not Working Through A LoadMovie Function
Can anyone out there help with this?

I'm trying to solve this (probably simple) path issue, and am not having much luck.

I've got 2 files (see attached):

File 1 (ex2mainfile.fla) has one button only that, when clicked, should load File 2 (ex2.swf) into a movie holder. It's not working (see attached)

File 2 (ex2.fla) is a drag and drop activity in which:
- Users listen to each of 5 audio files, then
- Drag the accent name on the right (American, Irish, etc) to the correct drop zone on the left

PROBLEM

1. When you test ex2.fla by itself the drag and drop work fine. BUT, when you test (ex2mainfile.fla), the startDrag function won't work

2. I have a number of different files which are causing similar problems. Sometimes it's the startDrag which won't work, other times it's the cursor which won't work / won't change into whatever it's supposed to change into. (Is this the same pathing issue as the startDrag? Or is it a completely separate issue?


Can anyone help?

(See attached files)

Thanks in advance for your time

Rob

View Replies !    View Related
Expert Help Needed - Motion Function With Dynamic Parameters
I must admit that i am slightly out of my depth when it comes to functions with dynamic parameters and cycle statements, but i have produced a script that i feel i am so close to cracking (and need to before thursday!).
I have a groundfloor plan (gf_mc), within which is many departments (dep_1, dep_2 etc). Upon rolling on each department, the department rises slightly in scale, whilst a roll out causes them to retract to normal. When the department is released, the x and y scales of the gf_mc increase, whilst the x and y co-ordinates alter, so that the screen has effectively zoomed in on the department. When a department is in focus, all others reduce in alpha to make them near transparent.



Code:
function motionTween (target, newX, newY, newXscale, newYscale, newAlpha) {

currentX = target._x
currentY = target._y
currentXscale = target._xscale
currentXscale = target._yscale
currentAlpha = target._alpha

speed = .1;

if (newX = undefined) {
newX = currentX
}
if (newY = undefined) {
newY = currentY
}
if (newXscale = undefined) {
newXscale = currentXscale
}
if (newYscale = undefined) {
newYscale = currentYscale
}
if (newAlpha = undefined) {
newAlpha = currentAlpha
}


this.onEnterFrame = function() {

var dx = newX - currentX;
var dy = newY - currentY;
var dxs = newXscale - currentXscale
var dys = newYscale - currentYscale
var da = newAlpha - currentAlpha

if ((dx < 1) && (dy < 1) && (dxs < 1) && (dys < 1) && (da < 1)) {
currentX = newX
currentY = newY
currentXscale = newXscale
currentYscale = newXscale
currentAlpha = newAlpha

delete this.onEnterFrame;
} else {
currentX += dx*speed;
currentY += dy*speed;
currentXscale += dxs*speed;
currentYscale += dys*speed;
currentAlpha += da*speed;
}
}
}


//groundfloor department array
gf_ar = new Array ()
gf_ar[1] = gf_mc.dep_1 //department 1
gf_ar[2] = gf_mc.dep_2 //department 2
gf_ar[3] = gf_mc.dep_3 //department 3
gf_ar[4] = gf_mc.dep_4 //department 4
// etc...

for (i=1; i<= gf_ar.length; i++) {
var iDep = _root.gf_mc["dep_"+i]

iDep.onRollover = function () {
this.motionTween (this, undefined, undefined, 120, 120, 90)
}
iDep.onRollout = function () {
this.motionTween (this, undefined, undefined, 100, 100, 60)
}

// on release of gf_mc.dep_?, this department is the focused department & perform the function with its set parameters
iDep.onRelease = function () {
this = focusdep
this.motionTween (gf_mc, this.newX, this.newY, this.newXscale, this.newYscale, 70)
}
}

//department perameters
with (_root.gf_mc.dep_1) {
newX = 16
newY = 690
newXscale = 350
newYscale = 350
}

with (_root.gf_mc.dep_2) {
newX = -620
newY = -796
newXscale = 432
newYscale = 432
}

with (_root.gf_mc.dep_3) {
newX = -70
newY = -520
newXscale = 365
newYscale = 365
}

with (_root.gf_mc.dep_4) {
newX = -455
newY = -335
newXscale = 315
newYscale = 315
}
Primarily, the problem is that the motion functions are not performed. I cannot figure out why.

Additionally, i have a few extra questions:
1. In the function Itself, i have nabbed the coding:

Code:
this.onEnterFrame = function () {
What is 'this' in this instance?

similarly, later i used

Code:
delete this.onEnterFrame;
am i right in thinking that that peice of coding is re-usable, and that it is not permanently deleted, only telling the motion function to stop?

2. Whenever i trace the focusdep, it is always undefined. So although the output bar updates when i release a department, it only displays 'undefined' again.


Code:
iDep.onRelease = function () {
this = focusdep
this.motionTween (gf_mc, this.newX, this.newY, this.newXscale, this.newYscale, 70)
}
trace(focusdep)
3. Finally, i have made an attempt at causing the unfocused (not zoomed in on) departments to fade when another department is selected.

Code:
iDep.onRelease = function () {
this = focusdep
this.motionTween (gf_mc, this.newX, this.newY, this.newXscale, this.newYscale, 70)
if ((iDep != focusDep) && (focusDep != undefined) {
this.motionTween (this, undefined, undefined, undefined, undefined, 40)
}
I have a feeling this is horribly inaccurate. I am trying to say:
"if gf_mc.dep_? is not the focused department and the focused department is not undefined, fade gf_mc.dep_? to 40 alpha"

Thank you for any help!

View Replies !    View Related
[MX04] Function Doesn't Work According To Path - Help Needed
ok, I've been fighting this since yesterday with no results and by now I'm going a bit desperate... if anyone out there knows of any info on this available through the web or have dealt with and cracked a similar problem, please, please, please, I could desperately use some advice.

I've searched for related issues, but none of them seems to cover this and I guess that's partly because, for absurd as it might sound, there's nothing wrong... let me make it clearer:

I'm programming a dinamic flash/xml website. up until now I've kept the info for the menus and the one for the gallery (the site has a gallery that displays both text and images) in separate xml files. but I'm trying to make all of it work out of a single xml file. I've managed to make the menus and the gallery all go get the info correctly to the xml (text and images), but then I came up with a problem that jeopardizes the whole show: a path inside the xml's onLoad function refuses to work! the code that bears the function has to be placed into the same clip as the clips that contain the text fields to wich info will be passed or it won't do a thing.

supose this is my actionscript code:


Code:
var contentSubMenu = new XML();
contentSubMenu.ignoreWhite = true;
contentSubMenu.load("example.xml");

//--------------------------------------------------

_root.contentSubMenu.onLoad = function() {

/* code */

//path to where the clips that bear the text fields to be filled are contained
var buttonList = _root.listSubMenu_mc.listWindow_mc.buttonListSlide_mc;

//example of buttonList usage:
//1) category loop
for (a=0; a<categories.length; a++) {
var category = categories[a];

//duplicates the clip that contains the category text field, assigns the proper category to that text field and adjusts the clips y position
buttonList.category_mc.duplicateMovieClip("category"+a+"_mc", getNextHighestDepth());
buttonList["category"+a+"_mc"].category_txt.text = category.toLowerCase();
...
...

/* loads of code */

}




unless _root.contentSubMenu.onLoad = function() and the code from there on is placed into _root.listSubMenu_mc.listWindow_mc.buttonListSlide _mc (right above category_mc),
no information is passed to that clip. If the path targets that clip one should expect it to, right? even if all this code is placed on _root, right? well, it doesn't happen...
I tried tracing for info that comes from the xml, but nothing is displayed in the output window.

I've attached a zip file that contains a fla file, an xml file, a txt file with the full chunk of actionscript code and the fonts you'll be needing should you decide to take a look (they're only two).

The fla file has been built in the following manner:
_on the right side, the clips that hold the text fields to wich the contentSubMenu.onLoad function will pass info to are directly placed upon [i]_root (so, following the code example from above, it would be like having var buttonList = _root;)
_on the left side, the clips that hold the text fields are down into buttonListSlide_mc and the contentSubMenu.onLoad function is there as well, only commented so it doesn't display anything.

that way one situation is compared with the other more easily.

I have no idea why this is and if it should work it would make my code and website a lot more cleaner and effective, so if anyone would like to help I'd be deeply thankful.

View Replies !    View Related
Creating A Kind Of Tricky Recursive Function - Help Needed
Hello everybody. I'm in a big big mess, trying to figure out how to do this for the last couple of days. I finaly came to the conclusion that I need a recursive function for what I'm trying to do.

Because it's a little hard to explain what I need.. I'll make an example.
So.. I have the figure below. I mean.. that's what I'm trying to achieve. For that figure I have data stored in the folowing way.

_root.marc is an Array.
All the paths that leave a square ... like From M0 if you choose 1 you'll get M1,
From M0 through 5 you'll get to M3.. and so on.
this is stored like
_root.marc[0].p - the paths. If _root.marc[x].p.length is 0.. that means that Mx is the last one.. and has no paths assigned, like shown in the figure.

My very big problem is that I need to position that MC's.. M3,M4.. all of them, according to the paths above them.

So, to position M2, i need to take a look at M1, and if it has any paths, more than one path, I need to move it further down. But this is not the end of it. If M1 has more paths that lead to other MC-s.. i need to take in considerations their paths too . This drove me mad for the last couple of days, and my time is slowly running out for my diploma

What I've tryed till now was to build a function let's say... getNextY(m) that should return a number. A "ponder"?..
like...to use it in a line like
M2._y = (currIndex + getNextY(1))*dy;// here it should return 5 for instance
M3._y = (currIndex + getNextY(2))*dy;// here getNextY should return 1
Why 5 or one? because it needs to take into account only if the paths are greater than 1.

CRAZY

If any one could help me with this I would be .... I would... I would cry and be greatfull for eternity .. I guess.

View Replies !    View Related
Stopping A Function And Return Back To Same Position - Help Needed
Any one pls help ,

Friends i have a function in that movieclips color will change according to time
what i need is if a specific action occurs say pressing a button (poweroff) or if the value of x==1; the function should be stopped where it is .....

if i press some other button say poweron the function should start again from the same place.....

Note: there is only one frame and stoping the movieclip like mc.stop(); not working in this case, return and killfunction completely get me out from the function.


function fadeArrayTrans(){
//trace("hai");
myCO = new Color(_root.lightsholder1.examplered1.SomeImageCli p);
myCO.fadeTransform(transArray[lastTransArray], 3750, fadeArrayTrans);
lastTransArray++;
//return;
lastTransArray%=transArray.length;
}

transArray = [];
transArray[0]={ra:100, rb:255, ga:100, gb:255, ba:100, bb:255, aa:100, ab:0};
transArray[1]={ra:100, rb:0, ga:100, gb:255, ba:100, bb:100, aa:100, ab:0};
transArray[2]={ra:100, rb:0, ga:100, gb:255, ba:100, bb:0, aa:100, ab:0};
transArray[3]={ra:100, rb:0, ga:100, gb:255, ba:100, bb:255, aa:100, ab:0};
transArray[4]={ra:100, rb:0, ga:100, gb:0, ba:100, bb:255, aa:100, ab:0};
transArray[5]={ra:100, rb:255, ga:100, gb:0, ba:100, bb:255, aa:100, ab:0};
transArray[6]={ra:100, rb:255, ga:100, gb:0, ba:100, bb:70, aa:100, ab:0};
transArray[7]={ra:100, rb:255, ga:100, gb:40, ba:100, bb:100, aa:100, ab:0};
lastTransArray = 0;

i have pasted small part of the code which may give idea about my problem. if you insist friends , i will post full script

Thanks in Advance

View Replies !    View Related
Creating A Kind Of Tricky Recursive Function - Help Needed
Hello everybody. I'm in a big big mess, trying to figure out how to do this for the last couple of days. I finaly came to the conclusion that I need a recursive function for what I'm trying to do.

Because it's a little hard to explain what I need.. I'll make an example.
So.. I have the figure below. I mean.. that's what I'm trying to achieve. For that figure I have data stored in the folowing way.

_root.marc is an Array.
All the paths that leave a square ... like From M0 if you choose 1 you'll get M1,
From M0 through 5 you'll get to M3.. and so on.
this is stored like
_root.marc[0].p - the paths. If _root.marc[x].p.length is 0.. that means that Mx is the last one.. and has no paths assigned, like shown in the figure.

My very big problem is that I need to position that MC's.. M3,M4.. all of them, according to the paths above them.

So, to position M2, i need to take a look at M1, and if it has any paths, more than one path, I need to move it further down. But this is not the end of it. If M1 has more paths that lead to other MC-s.. i need to take in considerations their paths too . This drove me mad for the last couple of days, and my time is slowly running out for my diploma

What I've tryed till now was to build a function let's say... getNextY(m) that should return a number. A "ponder"?..
like...to use it in a line like
M2._y = (currIndex + getNextY(1))*dy;// here it should return 5 for instance
M3._y = (currIndex + getNextY(2))*dy;// here getNextY should return 1
Why 5 or one? because it needs to take into account only if the paths are greater than 1.

CRAZY

If any one could help me with this I would be .... I would... I would cry and be greatfull for eternity .. I guess.

View Replies !    View Related
Adding A GoTo Command To A Function When Its Finished...? Plz Urgent Help Needed.
hi guys,
i have this function of a countdown timer, and im using it for a game. i dont know how to set up the actionscript of this function so that when the timer reaches 00, it will jump from the current scene, to my 'game-over' scene?

this is what i have in the script for the countdown timer:

howLong=100;
max = bar._x;
min = max - bar._width;
total = max-min; bar._x = max;
//initialize the text display
display_txt.text=howLong;

start_btn.onPress=function(){countDown()}

function countDown(){
var totalTime = howLong*1000;
var startTime = getTimer();
this.onEnterFrame=function(){
percent = (getTimer()-startTime)/totalTime;
bar._x = max-(percent*total); display_txt.text=Math.floor(howLong+1-(howLong*percent));
if (percent>1) {
this.onEnterFrame=null;
s=new Sound();
s.attachSound("smack");
s.start();
_parent[functionName]();
}
}
}

thank you very much

View Replies !    View Related
Call Function In A Class From LoadVars With Relative Path Needed. Please Help
Hi all, i´m new here. I´ve been searching an answer to my problem but haven´t found it yet. If someone can help, i´ll be really grateful!

I need to call a function defined inside a class i´ve created, but the function must be called from an loadVars.onLoad(success) object nested inside another function from the same class.

The problem is i can´t use the absolute path from the _root since i use more than one instance of the class.

Using _parent won´t work even if i try to do this:
loadVarsName._parent = this;
This statement works when the loadVars is not inside a class, but when i put it inside my class it stops working.

here is the code on my example.as file.

class example extends MovieClip {
}
public function callNewFunction() {
trace ("function called");
}
public function loadArds() {
var loadedTxt:LoadVars = new LoadVars();
loadedTxt.load("file.txt");
loadedTxt.onLoad = function(success) {
if (success) {
callNewFunction(); //here is my problem!!! no relative path can get me there.
}
}
}
}
//End Class


please help!!!!!!!!!! Thanks!

View Replies !    View Related
Help Needed: StartDrag/stopDrag Function Prevents Closing Popup Window
Hey all,

Summary:

I created a popup window inside my flash movie and it worked fine.
Then I decided that the user should have the ability to drag the window around if needed.
So, I added a startDrag/stopDrag function to it.

Problem:

Because I added the startDrag function, I can't close the popup window.
If I comment the drag function out, then I can close the window.
I can do one or the other, but not both.


I have a vague idea of what's happening.

Theory:

The close window command ( t.removeMovieClip() ) is not able to execute because
the "close button movie clip" is inside the popup window movie clip. Therefore, when I add the startDrag function, it gets dragged along with everything else. I believe that to
sovle this problem the startDrag function has to be cleared some sort of way
so that the "close button movie clip" can perform its function.

Well that's just my theory.

Here is my code:


Code:
//-----------------------This creates an empty movie clip----------------------\

this.createEmptyMovieClip("container_mc",1);

//-----------------------end of movie clip creation----------------------------\


//-------------This attaches movie clip to stage on button release-------------\

button.onRelease = function () {
var t:MovieClip = container_mc.attachMovie("popup","pop_mc",container_mc._level1());
t._x =100;
t._y =100;
t.closer.onRelease = function () {
t.removeMovieClip();
}

//---------------------end attach movie--------------------------------------\

//--------------------drag events--------------------------------------------\

t.onPress = function () {
t.startDrag();
}

t.onRelease = function () {
t.stopDrag();
}

//----------------------------end drag events------------------------------\

}
I have attached the fla file.
--------------------
Thanks in advance.

Hungry Samurai

View Replies !    View Related
PLEASE HELP Easing Scrollbar Code Needed To Add Mouse Wheel Function Not Working?
Hi,

I really appreciate some help here is the code below for my scrollbar which works fine but I can't get the mouse wheel code to work (I've taken it out since) How to add a mouselistener and get it to work with my scrollbar? Apparently some simple code but when I put it in nothing works please help if you could add the code in my code that might work.

I think I need to add some code that listens to the mouse wheel? PLEASE HELP! I only know VERY basic action script.


HERE is the code:

//Scrollbar Control//

fscommand("allowscale", "false");
bar.useHandCursor = dragger.useHandCursor=false;
space = 0;
friction = 0.3;
speed = 4;
y = dragger._y;
top = main._y;
bottom = main._y+mask_mc._height-main._height-space;
dragger.onPress = function() {
drag = true;
this.startDrag(false, this._x, this._parent.y, this._x, this._parent.y+this._parent.bar._height-this._height);
dragger.scrollEase();
};
dragger.onMouseUp = function() {
this.stopDrag();
drag = false;
};
bar.onPress = function() {
drag = true;
if (this._parent._ymouse>this._y+this._height-this._parent.dragger._height) {
this._parent.dragger._y = this._parent._ymouse;
this._parent.dragger._y = this._y+this._height-this._parent.dragger._height;
} else {
this._parent.dragger._y = this._parent._ymouse;
}
dragger.scrollEase();
};
bar.onMouseUp = function() {
drag = false;
};
moveDragger = function (d) {
if ((dragger._y>=y+bar._height-dragger._height && d == 1) || (dragger._y<=y && d == -1)) {
clearInterval(myInterval);
} else {
dragger._y += d;
dragger.scrollEase();
updateAfterEvent();
}
};
up_btn.onPress = function() {
myInterval = setInterval(moveDragger, 18, -1);
};
down_btn.onPress = function() {
myInterval = setInterval(moveDragger, 18, 1);
};
up_btn.onMouseUp = down_btn.onMouseUp=function () {
clearInterval(myInterval);
};
MovieClip.prototype.scrollEase = function() {
this.onEnterFrame = function() {
if (Math.abs(dy) == 0 && drag == false) {
delete this.onEnterFrame;
}
r = (this._y-y)/(bar._height-this._height);
dy = Math.round((((top-(top-bottom)*r)-main._y)/speed)*friction);
main._y += dy;
};
};

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved