Home­FAQ­Register­Memberlist­Log in
Post new topic   Reply to topicShare | 
 

 help with quality settings - actionscript

View previous topic View next topic Go down 
AuthorMessage
Justin
R6 KFC Employee


Number of posts: 115
Age: 18
Location: Vancouver, BC
Registration date: 2008-05-23

PostSubject: help with quality settings - actionscript   Fri Sep 12, 2008 6:34 pm

would be grateful if anyone could post the coding for automatically adjusting the quality settings to medium or low.

thanks a lot.
Back to top Go down
View user profile
Andy
R14 Principal


Number of posts: 413
Age: 16
Location: USA
Registration date: 2008-01-20

PostSubject: Re: help with quality settings - actionscript   Fri Sep 12, 2008 7:21 pm

Haha that's basic stuff.

_quality = "medium"
or "low"

Unless you mean something like finding the framerate and if itis very low, you change the quality?

If you mean that, I googled the formula for checking the framerate, so those comments aren't mine lol (I only added the last part) and added some limits and tweaks to it:

change the fps to your fps and the limits to whatever you want.
Code:
fps = 30;
var fps_limit_medium = 20;
var fps_limit_low = 10;


var timeinit:Date = new Date();
var lasttime = timeinit.getMilliseconds();
onEnterFrame = function () {
   var time:Date = new Date();
   //on each frame, figure out how much time has passed by comparing the milliseconds of the last frame to
   //the milliseconds of the current frame
   timepassed = ((time.getMilliseconds()-lasttime)>=0) ? (time.getMilliseconds()-lasttime) : (1000+(time.getMilliseconds()-lasttime));
   //convert the time passed between frames to frames per second. Round it to the nearest tenth.
   fps = Math.round(10000/timepassed)/10;
   //set last time for the next frame.
   lasttime = time.getMilliseconds();
   if (fps<=fps_limit_medium) {
      _quality = "medium";
      trace("sadf");
   }
   if (fps<=fps_limit_low) {
      _quality = "low";
   } else {
      _quality = "high";
   }
};

_________________


Back to top Go down
View user profile
Camaro
R14 Principal


Number of posts: 414
Age: 19
Location: USA
Registration date: 2008-01-21

PostSubject: Re: help with quality settings - actionscript   Fri Sep 12, 2008 7:42 pm

I think he just means the quality, as in low, medium, or high.
Back to top Go down
View user profile
Justin
R6 KFC Employee


Number of posts: 115
Age: 18
Location: Vancouver, BC
Registration date: 2008-05-23

PostSubject: Re: help with quality settings - actionscript   Fri Sep 12, 2008 8:27 pm

awesome, thanks andy.

im hopeless when it comes to any kind of scripting.

while im here you wouldn't mind telling me the script that disallows you to rightclick on the movie do you?
Back to top Go down
View user profile
Andy
R14 Principal


Number of posts: 413
Age: 16
Location: USA
Registration date: 2008-01-20

PostSubject: Re: help with quality settings - actionscript   Fri Sep 12, 2008 8:54 pm

Yeah, just do
Stage.showMenu=false;

If you just want to disable one thing, like the play or rewind, do this
root_cm = new ContextMenu();
root_cm.hideBuiltInItems();
_root.menu = root_cm;
root_cm = new ContextMenu();
root_cm.hideBuiltInItems();

var root_cm:ContextMenu = new ContextMenu ();
//code here
this.menu = my_cm;

_root.menu = root_cm;

and where it says //code here, you can add line with

root_cm.builtInItems.zoom=false;
root_cm.builtInItems.play=false;
root_cm.builtInItems.forward_back=false;
root_cm.builtInItems.rewind=false;
root_cm.builtInItems.loop=false;
root_cm.builtInItems.print=false;
root_cm.builtInItems.quality=false;

_________________


Back to top Go down
View user profile
killerkb
R10 Local Fisherman


Number of posts: 219
Age: 20
Location: The Netherlands - Amsterdam
Registration date: 2008-02-16

PostSubject: Re: help with quality settings - actionscript   Sat Sep 13, 2008 8:16 pm

root_cm = new ContextMenu();
root_cm.hideBuiltInItems();
root_cm.customItems.push(new ContextMenuItem("WHAT THE THING WILL SAY", itemHandler))
root_cm.customItems.push(new ContextMenuItem("WHAT THE THING WILL SAY", itemHandler2));
function itemHandler(obj:Object, item:ContextMenuItem) {
// what you want it to do
// examples: getURL("http://www.fluidanims.com", "_blank")
// _root._quality = "High";
// _root._quality = "Medium";
// _root._quality = "Low";
// THIS IS ALL FOR ONE SLOT ON THE MENU.
}
function itemHandler2(obj:Object, item:ContextMenuItem) {
// what you want it to do
// examples: getURL("http://www.fluidanims.com", "_blank")
// _root._quality = "High";
// _root._quality = "Medium";
// _root._quality = "Low";
// THIS IS ALL FOR ONE SLOT ON THE MENU.
}
_root.menu = root_cm;


This should work, right?
Back to top Go down
View user profile http://www.newgrounds.com
 

help with quality settings - actionscript

View previous topic View next topic Back to top 
Page 1 of 1

Permissions of this forum:You cannot reply to topics in this forum
Rive Studios :: General :: Help and Suggestions-
Post new topic   Reply to topic