Ciao devo fare un codice intelligente a partire da un codice stupido, e ho bisogno di aiuto che non ho una laurea in informatica forse non ce la faccio,
praticamente ho fatto una app per android con flex air quindi il codice in questione è actionscript ma a me serve un aiuto nella logica dello script più che per as
praticamente con actionscript mi devo caricare con lo StageWebView(); l'html di una pagina web lo stagewebview quindi è il contenitore che ha delle coordinate x e y
e siccome cè una testata nella schermata della app con il logo dell'azienda devo fare in modo che lo stagewebview non copra il logo perchè se metto un y poi in base alla risoluzione del device e alle sue dimensioni finisce che i contenuti sono troppo in basso o troppo in alto coprendo il logo
il codice è stupido ma funziona almeno parzialmente, il problema è che ci sono una trentina di device in cui questo codice dove funziona ma ce ne sempre qualcuno che non è compreso nello script e percio per quello non funziona
praticamente io ho dei dati per cui ad es con una densita di 168 e un'altezza di 736 la y va piazzata a 90 e cosi via per tutti i device io devo dedurre una regola in modo da fare un codice che in base a 3 parametri l'altezza la densita la y posso calcolare la y per altezze e densita diverse mi aiutate almeno per impostare la logica poi praticamente questo codice rimane utile per tutte le app fatte con air lo possiamo condividere se funziona, vi ringrazio tanto se mi aiutate
if(stage.stageHeight==736 && Capabilities.screenDPI==168){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
//motorola droid
if(stage.stageHeight==736 && Capabilities.screenDPI==265){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
//nexus
if(stage.stageHeight==736 && Capabilities.screenDPI==252){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
//droid x
if(stage.stageHeight==736 && Capabilities.screenDPI==228){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==736 && Capabilities.screenDPI==150){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==736 && Capabilities.screenDPI==233){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==480 && Capabilities.screenDPI==144 ){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==736 && Capabilities.screenDPI==217){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==736 && Capabilities.screenDPI==235){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==480 && Capabilities.screenDPI==160 ){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight!=736 && Capabilities.screenDPI==233){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==762 && Capabilities.screenDPI==252){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==752 && Capabilities.screenDPI==262){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==455 && Capabilities.screenDPI==181){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==775 && Capabilities.screenDPI==235){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==775 && Capabilities.screenDPI==216){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==455 && Capabilities.screenDPI==180){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight!=775 && Capabilities.screenDPI==233){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==775 && Capabilities.screenDPI==217){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==922 && Capabilities.screenDPI==256){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==762 && Capabilities.screenDPI==259){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==999 && Capabilities.screenDPI==170){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==762 && Capabilities.screenDPI==246){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==455 && Capabilities.screenDPI==170){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==762 && Capabilities.screenDPI==245){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==775 && Capabilities.screenDPI==215){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==301 && Capabilities.screenDPI==125){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==781 && Capabilities.screenDPI==133){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==502 && Capabilities.screenDPI==275){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==829 && Capabilities.screenDPI==165){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==816 && Capabilities.screenDPI==265){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==922 && Capabilities.screenDPI==275){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==455 && Capabilities.screenDPI==144){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==816 && Capabilities.screenDPI==228){
stageWebView.viewPort = new Rectangle(0,125,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==272 && Capabilities.screenDPI==150){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==301 && Capabilities.screenDPI==143){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==455 && Capabilities.screenDPI==165){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==455 && Capabilities.screenDPI==165){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==999 && Capabilities.screenDPI==169){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==1232 && Capabilities.screenDPI==170){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==480 && Capabilities.screenDPI==165){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
if(stage.stageHeight==1024 && Capabilities.screenDPI==160){
stageWebView.viewPort = new Rectangle(0,90,stage.stageWidth,stage.stageHeight);
}
}