Visualizzazione dei risultati da 1 a 5 su 5

Discussione: hitTest dello stage

  1. #1
    Utente di HTML.it L'avatar di ilpiubello
    Registrato dal
    May 2000
    Messaggi
    2,685

    hitTest dello stage: esiste?

    C'è un metodo per sapere se con il mouse sono all'interno del filmato oppure sono fuori? Qualcosa tipo l'hitTest delle MC.
    FaX

  2. #2
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    NO, ma qusta è una soluzione di peter hall:

    codice:
    onClipEvent (load) {
    	width = 640;
    	// stage width
    	height = 400;
    	// stage height
    	/*  extrapolation parameter:
    	* Low value (ie <1) = decrease chance of returning out when in
    	* High value (ie >1) = decrease chance of returning in when out
    	*/
    	extrap = 1;
    	//-------------------------------//
    	pointerOut = false;
    	x0;	x1;	y0;	y1;	dx;	dy;
    }
    onClipEvent (enterFrame) {
    	x1 = _level0._xmouse;
    	y1 = _level0._ymouse;
    	if (x1 == x0 && y1 == y0) {
    		// pointer movement not detected
    		// extrapolate to find expected mouse pos and test for inside/outside
    		if (x1 + extrap * dx < 0 || x1 + extrap * dx > width || y1 + extrap * dy < 0 || y1 + extrap * dy > height) {
    			pointerOut = true;
    		}
    	} else {
    		pointerOut = false;
    		dx = x1 - x0;
    		dy = y1 - y0;
    		x0 = x1;
    		y0 = y1;
    	}
    }
    Poi puoi verificare la posizione tramite javascript, o tramite un pulsante sullo stage. 1000 modi, ma nessuno sicuro..

  3. #3
    Utente di HTML.it L'avatar di ilpiubello
    Registrato dal
    May 2000
    Messaggi
    2,685
    E' possibile anche sapere tramite script le dimensioni dello stage?
    FaX

  4. #4
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    yes:

    Stage.width
    Stage.height

  5. #5
    Utente di HTML.it L'avatar di ilpiubello
    Registrato dal
    May 2000
    Messaggi
    2,685
    Grande!

    FaX

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.